Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
What is the code for closing a Windows Application form in Visual C#.
Posted

If you want to close your own application:

Application.Exit();


If you want to close a form:

Form frm = new Form1();
frm.Show(); //Shows the form
frm.Close(); //Closes the form


What exactly do you need?
 
Share this answer
 
v2
C#
Form1 form1= new  Form1();
form1.Close();


Form1 is the form class which you want to close if you want to close another form from current form.

C#
this.Close();

If you want to close current form.

C#
Application.Exit();

To close application.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900