Occurs when a thread is about to shut down. When the main thread for an application is about to be shut down, this event is raised first, followed by an ApplicationExit event.
[Visual Basic]
Public Shared Event ThreadExit As EventHandler
[C#]
public static event EventHandler ThreadExit;
[C++]
public: static __event EventHandler* ThreadExit;
[JScript] In JScript, you can handle the events defined by a class, but you cannot define your own.
Event Data
The event handler receives an argument of type EventArgs.
Remarks
You must attach the event handlers to the ThreadExit event to perform any unhandled, required tasks before the thread stops running. Close files opened by this thread, or dispose of objects that the garbage collector did not reclaim.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
Application Class | Application Members | System.Windows.Forms Namespace | ExitThread