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.