Changes to Flow Control

Several flow control statements were removed in Visual Basic .NET. I didn't think anyone was still using these statements, but apparently at least one developer was disappointed, perhaps even upset, that GoSub is no longer supported in Visual Basic .NET.

The fact is that GoSubs result in spaghetti code and should not be used anyway. (The last time I wrote one was in GW-BASIC.) Several flow control features have been revised from VB6 to Visual Basic .NET.

Replace GoSub with Function Call

The GoSub is no longer supported. Where you employed a GoSub in your VB6 code, Visual Basic .NET requires that you replace the GoSub with a function call. The following Command button event handler demonstrates a GoSub in VB6.

 Private ...

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.