I ran the .exe for my program from the debug folder. It worked, but when I closed it, I discovered that it was still listed on the processes list in the Task Manager.
I figure I must've forgotten a step, since it's my first winforms program.
asked Mar 10, 2010 at 3:07
Slateboard
1,0296 gold badges16 silver badges33 bronze badges
1 Answer 1
As long as the code in your Main method looks like this:
Application.Run(new MainForm());
Then you should be OK (assuming "MainForm" is the name of your main form). WinForms will exit the process when the form you pass in to Application.Run closes.
Otherwise you can call Application.Exit() yourself in your form's "Closed" event handler.
answered Mar 10, 2010 at 3:12
Dean Harding
72.9k13 gold badges151 silver badges180 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Slateboard
The Program was converted from a console application, so I managed to fix it by copying the Main method from my program.cs to my form.cs.
lang-cs