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 ,以顯示已發生的錯誤。

適用於

另請參閱