Returns an Exception representing the error that occurred.
[Visual Basic] Overridable Public Function GetException() As Exception [C#] public virtual Exception GetException(); [C++] public: virtual Exception* GetException(); [JScript] public function GetException() : Exception;
An Exception representing the error that occurred.
The following example creates a new instance of ErrorEventArgs and initializes it with an Exception. GetException is then called to retrieve the Exception and display the error message. There is no form associated with this code.
[Visual Basic]
'The main entry point for the application Shared Sub Main() ' Declare an ErrorEventArgs. Dim myErrorEventArgs As ErrorEventArgs ' Declare Exception objects Dim myException As Exception Dim myException1 As Exception ' Create an exception object Set myException = New Exception("This is an exception test") ' Create an ErrorEventArgs containing the exception object Set myErrorEventArgs = New ErrorEventArgs(myException) ' Extract the exception from the ErrorEventArgs. Set myException1 = myErrorEventArgs.GetException ' Display the exception returned from the ErrorEventArgs object. MessageBox.Show "The exception returned is: " & myException1.Message, "ErrorEventArgs" End Sub
ErrorEventArgs Class | ErrorEventArgs Members | System.WinForms Namespace