What is the best way to close your application in VB.NET. I have an mdi application with 10 child forms. My application starts with my MDI form. When user hits the Exit menu option, I just call End. Is it okay or is there a better way ?
Printable View
What is the best way to close your application in VB.NET. I have an mdi application with 10 child forms. My application starts with my MDI form. When user hits the Exit menu option, I just call End. Is it okay or is there a better way ?
Use Application.Exit() method :
Quote:
From MS Help File :
Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed
This method stops all running message loops on all threads and closes all windows of the application. This method does not force the application to exit. The Exit method is typically called from within a message loop, and forces Run to return. To exit a message loop for the current thread only, call ExitThread.
Yup, use Application.Exit as Pirate said. I think End abruptly stops all executing threads, which is not recommended.