Initializes a new instance of the ThreadExceptionEventArgs class.
[Visual Basic] Public Sub New( _ ByVal t As Exception _ ) [C#] public ThreadExceptionEventArgs( Exception t ); [C++] public: ThreadExceptionEventArgs( Exception* t ); [JScript] public function ThreadExceptionEventArgs( t : Exception );
The following example creates a new instance of ThreadExceptionEventArgs 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 Class | ThreadExceptionEventArgs Members | System.Threading Namespace | Thread | ThreadStart