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!

ThreadExceptionEventArgs Class

Provides data for the System.WinForms.Application.OnThreadException event.

Object
   EventArgs
      ThreadExceptionEventArgs

[Visual Basic]
Public Class ThreadExceptionEventArgs
   Inherits EventArgs
[C#]
public class ThreadExceptionEventArgs : EventArgs
[C++]
public __gc class ThreadExceptionEventArgs : public EventArgs
[JScript]
public class ThreadExceptionEventArgs extends EventArgs

Remarks

A ThreadExceptionEventArgs is created by a thread when an unhandled exception occurs. TBD contains the Exception that occurred.

Requirements

Namespace: System.Threading

Assembly: System.dll

Example [Visual Basic]

The following example creates a new instance of TBD and initializes it with an TBD. The Exception is then retrieved from the exception field and the error message displayed. No form is associated with this code.

[Visual Basic]

'The main entry point for the application
Shared Sub Main()
   ' Declare a ThreadExceptionEventArgs.
   Dim myEventArgs As ThreadExceptionEventArgs
   ' 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 a ThreadExceptionEventArgs containing the exception object
   Set myEventArgs = New ThreadExceptionEventArgs(myException)
   ' Extract the exception from the ThreadExceptionEventArgs.
   Set myException1 = myEventArgs.exception
   ' Display the exception returned from the ThreadExceptionEventArgs object.
   MessageBox.Show "The exception returned is: " & myException1.Message, "ThreadExceptionEventArgs"
End Sub

See Also

ThreadExceptionEventArgs Members | System.Threading Namespace | Thread | ThreadStart | System.WinForms.ThreadExceptionDialog | ThreadExceptionEventHandler