Possible Duplicate:
How do I prevent the app from terminating when I close the startup form?
How can i stop the application from ending when the main form is closed?
I want to check if the Application.OpenForms.Count == 1
and only then close the application if its true. So I want to close the app when the last of the forms is closed.