Method
Quit
Description
Quits the application.
Usage
Quit([ status ])
Part |
Type |
Description |
---|---|---|
status |
For console applications only, the optional parameter returns a status code. |
Notes
Calling the Quit method will call the DesktopApplication class's CancelClosing event. To cancel the close, return True from this event. If it does not return True, each window's CancelClosing event handler is called. CancelClosing and Close are called as a pair for each open window.
If a CancelClosing event handler returns False (the default action) then the window's Closing event handler is called. If any window's CancelClosing event handler returns True, the app will not Quit and no further CancelClosing or Closing events will be called.
An EndException is raised when you call Quit. It causes the app to Quit gracefully. Usually you do not see the EndException unless you use a catch-all Exception statement.
If you just need to have your app Quit when last window is closed, you can use the DesktopApplication.AllowAutoQuit property.
Sample code
This example quits the application.
Quit
Compatibility
Desktop, console and web project types on all supported operating systems.
See also
DesktopApplication, DesktopQuitMenuItem, EndException classes.