Structured Exception Handling

Visual Basic .NET still supports On Error Goto error handling, but you should replace the old VB6 style On Error Goto statements with structured exception handling. (It's also likely that On Error Goto will be removed in future versions of VB; Microsoft is giving us a chance to get used to exceptions.)

Structured exceptions are one aspect of VB .NET that promote VB to a first-class language. Exceptions are subclassed from Objects and exception handling is more robust and precise than On Error Goto.

Exception handling was invented as a means of replacing the error-prone error code return value and supports writing more robust applications. Exception handling in VB .NET supports Try...Catch exception blocks and Try...Finally ...

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.