Why won't Application.Exit() quit a Windows Forms application?
c#, windows, winforms
Solution
Have you tried to put a breakpoint in the event handler to see if it is being hit?
If so, the application won't exit if the window messages aren't being delivered (i.e. the UI thread is blocked). One way to test this is to call `Environment.Exit()` which is more brutal about forcing a close. If this succeeds, you can then figure out why `Application.Exit()` isn't working.
Problem
I am working on learning Windows Forms with C# and have a bare bones application. I am trying to close it when the user selects File->Exit. I have an event handler attached to it and I have tried calling `Application.Exit()`, `Application.ExitThread()` and just closing the form. Nothing. It stays there. I'm not creating any other threads of any sort either. Ideas? Thanks.