An application raises the Shutdown event before it exits. This allows you to control how the application closes its resources. This event is part of the Visual Basic Application model. For more information, see Overview of the Visual Basic Application Model.
The code for the Shutdown event handler is stored in the ApplicationEvents.vb file, which is hidden by default.
To access the Code Editor window for application events
-
With a project selected in Solution Explorer, click Properties on the Project menu.
-
Click the Application tab.
-
Click the View Application Events button to open the Code Editor.
For more information, see How to: Handle Application Events (Visual Basic).