Can the Form.Close be overriden

  • Thread starter Thread starter Hasani
  • Start date Start date
H

Hasani

Is there a way to prevent a form from being closed?
For now, I added a method that 'blocks' the form from closing, but since
it's blocking, the form will not accept any other events, such as Move,
Resize, etc.
 
Hi Hasani
Override Form.OnClosing (or add a handler to Closing event) and set event
argument's Cancel property to *true*. This will stop form from closing.

HTH
B\rgds
100
 
* "Hasani said:
Is there a way to prevent a form from being closed?
For now, I added a method that 'blocks' the form from closing, but since
it's blocking, the form will not accept any other events, such as Move,
Resize, etc.

In the form's 'Closing' event handler, set 'e.Handled = True'.
 
i don't think my post or maybe it was sent to as an email to 100, but when
through but
I tried overriding the onclose event, and I thought, that by not calling
base.OnClose, I could prevent the form from closing, but i was wrong. I did
what you mentioned in my post and all is working well now!!!!
THX!!!!!!!

=]
 
Back
Top