Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How do I force a Windows Form application to exit?

Your main form is an object of type System.Windows.Forms.Form. Use its Close method to exit the application. If you wish to Exit from a Form's constructor, this will not work. A workaround is to set a boolean flag that you can later check in the Form's Load method to call Close if required.

Another way is to use the Application.Exit() method.

Contributed from George Shepherd's Windows Forms FAQ



Page view counter