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 While...Wend1: Sub WhileEndWhileTest() 2: 3: Dim I As Integer = 1 4: While (I < 10) 5: I += 1 6: Debug.WriteLine(I) 7: End While 8: 9: End Sub The fundamental behavior of the loop hasn't changed. A While...End While loop processes zero or more times and when you type While, the End While is added automatically for you, completing the block. Use While...End While exactly as you would the VB6 While Wend loop. |
Team-Fly |
Top |