GetException Function
The document is archived and information here might be outdated

GetException Function

Returns the exception representing the error that occurred.

Overridable Public Function GetException() As Exception

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.

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.
' Assigns the exception from the Err object to myError.
myError = Err.GetException()
' Displays the message associated with the exception.

Namespace: Microsoft.VisualBasic

Class: Err Object

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

© 2016 Microsoft