Share via


Exception and Error Handling in Visual Basic

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

  • Language Changes for Visual Basic 6.0 Users
    Summarizes language element changes in Visual Basic.

  • Debugger Roadmap
    Discusses the fundamentals of using the Visual Studio debugger. Topics include debugging basics, execution control, attaching to a running program, Just-In-Time debugging, launching the debugger automatically, dumps, breakpoints, inspecting your program, handling exceptions, Edit and Continue, and using expressions in the debugger.

  • Just-In-Time Debugging
    Describes just-in-time debugging, a feature that launches the Visual Studio debugger automatically when a program running outside Visual Studio encounters a fatal error.

  • Debugging Managed Code
    Covers common debugging problems and techniques for managed applications.

  • Exception Assistant
    Describes the Exception Assistant feature, which facilitates troubleshooting run-time errors.

  • Edit and Continue
    Describes Edit and Continue, a time-saving feature that allows you to make changes to source code while the program is in break mode.

  • COM and ActiveX Debugging
    Provides tips on debugging COM applications and ActiveX controls.