ErrObject.GetException 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳代表所發生錯誤的例外。
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 特性來顯示已發生的錯誤。