Spooks
Spooks

Reputation: 7187

Closing MDIParent Form, application is still running in task manager

So I can't seem to completely exit the application, I want this to happen when the user clicks the (x) button. is there a certain command like application.exit I can put somewhere (maybe FormClosed()?)

Thank you!

Upvotes: 0

Views: 1051

Answers (2)

buharaduadrian
buharaduadrian

Reputation: 21

You need an Event Handler that runs after that particular MDIParent closes. Example:

 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.Exit();
        }

Upvotes: 0

SLaks
SLaks

Reputation: 887837

After closing the last form, the application should exit on its own.

If it isn't, you probably have some other code which is still running.
Pause the program in a debugger and cehck what it's doing.

Upvotes: 2

Related Questions