Occurs when the application shuts down.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
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
The following table lists examples of tasks involving the My.Application.Shutdown event.
Use the events provided by the Visual Basic Application model to run code
Log a message when the application shuts down
Availability by Project Type
Windows Forms Application
Windows Forms Control Library
Web Control Library
This example logs messages when the application shuts down.
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 (Visual Basic).
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.