Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

Shutdown Event

Location

My.Application.Shutdown

Syntax

Public Sub Me_Shutdown(ByVal sender As Object, _ ByVal e As EventArgs) Handles Me.Shutdown End Sub

sender (required; Object)

The object that raised the event

e (required; EventArgs)

An event parameter of type System.EventArgs, with no special members

Description

The Shutdown event occurs when the application shuts down.

Usage at a Glance

  • This event is only available in Windows Forms applications.

  • This event handler can be found in the ApplicationEvents.vb source code file for your project. This file is normally hidden, but it can be viewed by toggling the Show All Files button in the Solution Explorer window in Visual Studio.

Example

The Shutdown event's code appears in the ApplicationEvents.vb file in a Windows Forms application.

Namespace My Class MyApplication Private Sub MyApplication_Shutdown(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Shutdown Console.WriteLine("See you later.") End Sub End Class End Namespace

Related Framework Entries

  • Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Shutdown Event

See Also

Application Object, Startup Event, StartupNextInstance Event, UnhandledException Event

Категории