C # - window form application - close application

I need help. I have a window-shaped application. Whenever I click “close” a form, the application should close.

Can anybody help me.

Regards, Justin Samuel.

+3
source share
4 answers

After your explanation:

In Form1, do something like:

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

This suggests that Form2 can be shown Modal (Dialog), which I believe is true

+5
source

Winforms will automatically exit when the main form is closed. The main form is the form that is created and passed to the Application.Run method in the main application method.

, , - , ( ), .

+2
0

Source: https://habr.com/ru/post/1721975/


All Articles