c# Application exits when Main form closes
c#, exit, hide, winforms
Solution
In your `Program.cs` file you have a line like `Application.Run(new Form1())`. Replace it with
var main_form = new Form1();
main_form.Show();
Application.Run();
Also you need to close application explicitly by call `Application.Exit()` where you want.
Problem
I'm writing a multi form application, and I'd like to be able to close Form1 with out the application closing. Right now i'm using `this.Hide` to hide the form. Is there a way to set it so i can close any form, or the application should only exist when all the forms are closed? I think i remember seeing something like that at one point, but that might not have been visual studio and c#.