We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

How to: Check an Exception's Inner Exception (Visual Basic)

In cases where an exception is thrown as a direct result of a previous exception, the InnerException property describes the original error. This information may allow 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.


Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To check an InnerException

  • Check the InnerException property of the exception to determine the cause of the original error.

        My.Computer.FileSystem.CopyFile("file1", "file2")
    Catch ex As System.IO.IOException
    End Try