Live Chat Icon For mobile
Live Chat Icon

How do I force a Windows Form application to exit

Platform: WinForms| Category: Form

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.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.