ErrObject.GetException 方法

定义

返回表示发生的错误的异常。

public:
 Exception ^ GetException();
public Exception? GetException();
public Exception GetException();
member this.GetException : unit -> Exception
Public Function GetException () As Exception

返回

表示发生的错误的异常。

示例

以下代码显示分配给对象中 Err 异常的消息:

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)

注解

GetException 函数仅适用于 Err 对象类。 它与对象的属性Exception一起使用Err,以显示已发生的错误。

适用于

另请参阅