Closing Event

  • Thread starter Thread starter Clyde
  • Start date Start date
C

Clyde

Windows Forms provides a Closing event that the form being
closed can cancel. It seems clear for modal dialogs but
not for modeless forms.
The method Close() on the form causes the event to occur
but doesn't return a value. How can the element doing the
closing know the form didn't want to be closed?

I'm trying to implement permissions where each form can
determine whether it can be closed normally.
Clyde
 
* "Clyde said:
Windows Forms provides a Closing event that the form being
closed can cancel. It seems clear for modal dialogs but
not for modeless forms.
The method Close() on the form causes the event to occur
but doesn't return a value. How can the element doing the
closing know the form didn't want to be closed?

Set the form's 'DialogResult' property in the 'Closing' event handler
and check it by the calling form.
 
Thanks, that seems to work.
Clyde
-----Original Message-----


Set the form's 'DialogResult' property in the 'Closing' event handler
and check it by the calling form.
 
Back
Top