Also, you should not be calling Environment.Exit. As I said earlier, if you set e.Cancel to True in the Startup event handler then the startup form will not be created and the application will close of its own accord.