Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - window form application - Close the application

Tags:

c#

.net

winforms

I want a help. I have a window form application. Whenever I click on the "close" of the form, the application should itself close.

Can anyone help me.

Regards, Justin Samuel.

like image 459
Justin Samuel Avatar asked Dec 29 '22 12:12

Justin Samuel


1 Answers

After your explanation:

In Form1, do something like:

  Form2 f2 = new Form2();
  f2.ShowDialog();
  this.Close();
  Application.Exit();

This is assuming Form2 can be shown Modal (Dialog), which I think is correct

like image 103
Henk Holterman Avatar answered Jan 11 '23 10:01

Henk Holterman