Troubleshooting Exception Handling (Visual Basic)
This topic describes problems commonly encountered when working with exceptions and how to address them.
Visual Basic supports structured exception handling, which you can use to create and maintain programs with robust, comprehensive error handlers. Structured exception handling is code designed to detect and respond to errors during execution by combining a control structure (similar to Select Case or While) with exceptions, protected blocks of code, and filters.
In cases where an exception is thrown as a direct result of a previous exception, the InnerException property describes the original error. This information helps you to handle the error more efficiently. If there is no original error, the value of InnerException will be a null reference or Nothing in Visual Basic. This property is read-only. For more information, see How to: Check an Exception's Inner Exception (Visual Basic).
Your code may not correctly catch exceptions if you order your Catch blocks incorrectly. Your Catch statements should move from most specific to least specific. A Catch block by itself will catch all exceptions derived from Exception, and therefore should always be placed as the last block before Finally.