Initializes a new instance of the ErrorEventArgs class.
[Visual Basic] Public Sub New( _ ByVal exception As Exception _ ) [C#] public ErrorEventArgs( Exception exception ); [C++] public: ErrorEventArgs( Exception* exception ); [JScript] public function ErrorEventArgs( exception : Exception );
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