How to Finish the Program

  • Thread starter Thread starter Martijn Mulder
  • Start date Start date
M

Martijn Mulder

What method can I call to terminate my Forms-based application and give
control back to the system?
 
Martijn Mulder said:
What method can I call to terminate my Forms-based application and give
control back to the system?


Call the main form's 'Close' method.
 
Just call this method.


Yes, I have that. From somewhere deep inside the code, in response to a
certain event, I call the static method

System.Windows.Forms.Application.Exit();

to finish the program and return control to the operating system
 
What is the preferred method for closing a forms based application? Is
it using the forms "Close" method, "Application.Exit", or perhaps the
key word "END"? I am looking for a best practices answer so please
clarify the "why" if you consider one way better than another.

-Thanks
 
What is the preferred method for closing a forms based application?


From somewhere deep inside the code, in response to a
certain event, call the static method

System.Windows.Forms.Application.Exit();

to finish the program and return control to the operating system
 
Back
Top