Visual Basic supports structured exception (error) handling, which allows the program to detect and possibly recover from errors during execution. Visual Basic uses an enhanced version of the Try...Catch...Finally syntax already supported by other languages such as C++. Structured exception handling combines a modern control structure (similar to Select Case or While) with exceptions, protected blocks of code, and filters.
Structured exception handling, which is the recommended method of error handling in Visual Basic, makes it easy to create and maintain programs with robust, comprehensive error handlers. Unstructured exception handling using On Error can degrade application performance and result in code that is difficult to debug and maintain.
In This Section
- Introduction to Exception Handling
- Summarizes how to handle exceptions in your programs.
- Types of Errors
- Provides an overview of syntax errors, run-time errors, and logic errors.
- Structured Exception Handling
- Discusses structured exception handling in Visual Basic .NET, with code examples.
- Unstructured Exception Handling
- Discusses unstructured exception handling in Visual Basic .NET, with code examples.
- Language Changes in Visual Basic
- Summarizes language element changes in Visual Basic .NET.