Application.Exit() does not remove windows form from Memory.

Here is my start/exit code to run and quit the application. It closes everything, but the .exe file is still in memory. How can I make the application full exit and remove itself from memory?

static void Main()
      Application.Run(new IMProgram());
private void menuItemExit_Click(object sender, System.EventArgs e)
      foreach(Form frmOne in this.OwnedForms)

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try changeing



bradtmAuthor Commented:
tpwells: The application is still in memory with this.Close().
do you know if the Main() is getting past the Application.Run(new IMProgram());

I know that this tells the program to run the new IMProgram() class and when that class is over then the program ends.

But test it to make sure it actually finishes with that call. Try placing a MessagBox.Show("Done"); after the Application.Run and once you Close the program if the messagebox fails to popup then we will know that the process is not ending on close and its hanging somewhere else.
What does the class IMProgram further do.. There is something that is locking inside there, like a thread or something.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bradtmAuthor Commented:
Yep, it was a thread still running. Thanks guys!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.