次の方法で共有


ErrObject.GetException Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns the exception representing the error that occurred.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Syntax

'Declaration
Public Function GetException As Exception
public Exception GetException()

Return Value

Type: System.Exception
Returns the exception representing the error that occurred.

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.

Examples

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.
Dim Msg = myError.Message

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.