Application does not terminate when clicking on 'X' in titlebar

J

Jo Siffert

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
 
F

Frank Eller

Hi Jo,

Jo said:
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 ...
 
J

Jo Siffert

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top