I have a C# Form
, where you have Form1
shown at the start, and when you press Go
you are taken to Form2
. Form1
is hidden and Form2
is shown.
Now when you exit form2
, the whole application should be closed. I am using Application.Exit()
when I press the exit button.
I am facing problems if the user presses X or ALT+F4 or RightClick->Close
.
The form will close but the hidden form will stay opened.
How can I fix that? When I press one of these control button, for all hidden forms to also close?
I tried form1_Close
and Form1_Closing
function but they didn't seem to work.