Flow Control Statements

Several flow control statements have been revised in Visual Basic .NET. GoSub is no longer supported. The Call keyword is supported but no longer required for function and subroutine calls and will probably disappear in future versions of VB .NET.

On Goto and On Gosub computed branching is no longer supported. Replace computed branch statements with the Select Case statement. On Error Goto is supported for backward compatibility but should be replaced with structured exception handling (see the section “Structured Exception Handling” for details).

The While...Wend statement block still exists, but Wend has been replaced with End While. Listing 2.14 demonstrates While...End While.

Listing 2.14. While...End While replaces ...

Get Visual Basic® .NET Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.