Closing Event

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
 
H

Herfried K. Wagner [MVP]

* "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.
 
C

Clyde

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.
 

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