Your application started with this line:
Application.Run(new Form1());
this call waits until the form1 ends. Than the execution will continue from
the next line which will exit the function and ultimately exiting the entire
application because its inside the "Main" function. Now when you show the
Form2 and then you close it, you need to call the close method of form1
also. Do something like this:
//inside your Form1 at the time of showing the form2
this.Hide();
Form2 form2 = new Form2();
form2.ShowDialog( this );
//form1 execution is stuck here and waiting for form2 to close so it can
continue doing its thing.
Close(); //the application exits cuz form1 is closing. This line will be
called when the Form2 closes.
Hope that helps.
Ab.
http://joehacker.blogspot.com.
"Keith Smith" <ke*********@verizon.net> wrote in message
news:L5fLd.194$Kj4.85@trnddc09...
When your main form closes, the program ends. Try using Hide instead of
Close.
P.
That works to a point... But when I close Form2 the application still
appears to stay running in the background (I concluded that because I have
to hit the "stop" button in order to make it completely exit).
Any ideas how to make the application completely end when I click on the
"X" to close Form2?