Hi,
when I try to close my application using the 'X' in the Windows
titlebar, nothing happens - neither Form.Dispose() is called not the
Closing or Closed events are raised. The application just keeps running.
If I close the application using Application.Close(), everything works fine.
What does the runtime do when hitting the X button? Is there any way to
intercept this action?
Thanks a lot,
Jo
Frank Eller - 10 Dec 2004 18:14 GMT
Hi Jo,
> Hi,
>
> when I try to close my application using the 'X' in the Windows
> titlebar, nothing happens - neither Form.Dispose() is called not the
> Closing or Closed events are raised. The application just keeps
> running.
That's very unusual ...
> If I close the application using Application.Close(), everything
> works fine.
> What does the runtime do when hitting the X button? Is there any way
> to intercept this action?
Usually, "Application.Close()" is called. Your App should terminate. Is
there anything else you might have changed? I never had that behaviour in
any application ...

Signature
Frank Eller
www.frankeller.de
Herfried K. Wagner [MVP] - 10 Dec 2004 19:44 GMT
"Jo Siffert" <jo.siffert@gmx.net> schrieb:
> when I try to close my application using the 'X' in the Windows titlebar,
> nothing happens - neither Form.Dispose() is called not the Closing or
> Closed events are raised. The application just keeps running.
Maybe this bug:
Windows Forms Bug
<URL:http://www.jelovic.com/weblog/e41.htm>

Signature
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/
Jo Siffert - 10 Dec 2004 20:58 GMT
It is indeed this bug. I figured out which controls are in the
unvalidatedControls collection and forced those to be removed by calling
OnControlRemoved(...) - now the form closes properly.
Thanks a lot for this hint!
I am wondering why the problem still exists on .NET 1.1 SP1...
/Jo
> "Jo Siffert" <jo.siffert@gmx.net> schrieb:
>
[quoted text clipped - 6 lines]
> Windows Forms Bug
> <URL:http://www.jelovic.com/weblog/e41.htm