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
A ThreadExceptionEventArgs is created by a thread when an unhandled exception occurs. TBD contains the Exception that occurred.
Namespace: System.Threading
Assembly: System.dll
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
ThreadExceptionEventArgs Members | System.Threading Namespace | Thread | ThreadStart | System.WinForms.ThreadExceptionDialog | ThreadExceptionEventHandler