This documentation is archived and is not being maintained.

Statement is no longer supported

Visual Studio .NET 2003

In Visual Basic .NET, the GoSub...Return and On...GoSub statements are no longer supported. These statements were supported in Visual Basic 6.0 for compatibility with earlier versions of the Basic language; they are not compatible with object-oriented programming practices.

What to do next

  • Replace GoSub statements with Call, Function, or Sub statements. The Return keyword is no longer needed.
  • Replace On...GoSub statements with Select Case statements, as shown in the following example:
    ' Visual Basic 6.0
    On x GoSub 1000, 2000
    1000:
       MyString = "Hello"
    2000:
       MyString = "Goodbye"
    
    ' Visual Basic .NET
    Select Case x
       Case 1000
          MyString = "Hello"
       Case 2000
          MyString = "Goodbye"
    End Select
    

See Also

Control Statement Changes in Visual Basic

Show: