Export (0) Print
Expand All

GetException Function

Returns the exception representing the error that occurred.

Overridable Public Function GetException() As Exception

Remarks

The GetException function is available only from the Err object class. It works with the Exception property of the Err object to display the error that has occurred.

Example

The following code displays the message assigned to the exception in the Err object:

On Error Resume Next
Dim myError As System.Exception
' Generate an overflow exception.
Err.Raise(6)
' Assigns the exception from the Err object to myError.
myError = Err.GetException()
' Displays the message associated with the exception.
MsgBox(myError.Message)

Requirements

Namespace: Microsoft.VisualBasic

Class: Err Object

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

Err Object | Structured Exception Handling | Unstructured Exception Handling

Show:
© 2014 Microsoft