Preventing application from closing after closing main form.

Unimatrix_001
Unimatrix_001 used Ask the Experts™
on
Hello.

The startup object for Application is a form, which on a certain event loads another form and then closes itself, but when then form closes itself it also ends the application. How can I stop this?

Thanks,
Uni
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Option 1. You can make the another form as the main and you can start that form before you show the main form
Option 2. Search for Application.Exit() and remove it from the Main Form
Option 3, that would be easier: Map OnClose, hide the Form instead of Close
e.g
private void YourForm_FormClosing(object sender, FormClosingEventArgs e)
{
  this.Hide();
  e.Cancel = true;
}

Open in new window

Author

Commented:
Thanks. :)

Uni

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial