Adds an event handler for the Exit event.
[Visual Basic] Public Shared Sub AddOnApplicationExit( _ ByVal handler As EventHandler _ ) [C#] public static void AddOnApplicationExit( EventHandler handler ); [C++] public: static void AddOnApplicationExit( EventHandler* handler ); [JScript] public static function AddOnApplicationExit( handler : EventHandler );
You can use this event-handling method to dispose objects that the garbage collection did not reclaim, to close open files, or to do anything else that is required before an application stops running.
Application Class | Application Members | System.WinForms Namespace