NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

ErrorEventArgs Constructor

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
);

Parameters

exception
An Exception representing the error that occurred.

Example [Visual Basic]

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

See Also

ErrorEventArgs Class | ErrorEventArgs Members | System.WinForms Namespace