How to: Specify Shutdown Behavior for an Application (Visual Basic)
This topic applies only to Visual Basic projects.
The Shutdown mode property for a Windows Application project determines the shutdown behavior for the application. When set to When startup form closes (the default), the application ends, when the form set as the Startup object closes, even if other forms are open. When set to When last form closes, the application ends when the last form is closed or when Exit or the End statement is called explicitly.
The Shutdown mode property can be set on the Application page of the Project Designer.
To change shutdown behavior
With a project selected in Solution Explorer, on the Project menu, click Properties.
Click the Application tab.
In the Shutdown mode drop-down list, select either When startup form closes or When last form closes.