ErrObject.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 特性來顯示已發生的錯誤。

適用於

另請參閱