Export (0) Print
Expand All

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.

NoteNote

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.

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

Community Additions

ADD
Show:
© 2014 Microsoft