Forms Application Base. Shutdown Event
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when the application shuts down.
public: event Microsoft::VisualBasic::ApplicationServices::ShutdownEventHandler ^ Shutdown;
public event Microsoft.VisualBasic.ApplicationServices.ShutdownEventHandler Shutdown;
member this.Shutdown : Microsoft.VisualBasic.ApplicationServices.ShutdownEventHandler
Public Custom Event Shutdown As ShutdownEventHandler
Public Event Shutdown As ShutdownEventHandler
This example logs messages when the application shuts down.
Private Sub MyApplication_Shutdown( sender As Object, e As System.EventArgs ) Handles Me.Shutdown My.Application.Log.WriteEntry("Application Shut Down.") End Sub
You must enter the code in the Code Editor window for application events. To access this window, follow the instructions from this topic's Remarks section. For more information, see How to: Log Messages When the Application Starts or Shuts Down.
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|
|1. With a project selected in Solution Explorer, click Properties on the Project menu.
2. Click the Application tab.
3. Click the View Application Events button to open the Code Editor.
For more information, see Application Page, Project Designer (Visual Basic).
Availability by Project Type
|Windows Forms Application||Yes|
|Windows Forms Control Library||No|
|Web Control Library||No|