Is form closed? by:Tom
|
Another question: Is there a way to determine if a form has been closed? I.E. A property or something? Like an IsClosed or something similar? I have instances where I load a new form, and in that new form I have overridden the New constructor which may (after reading some data) decide to close the form before it is shown. I would like to be able to tell from the caller if that form had already been closed. I can setup my own property like Cancelled (as a boolean) and set/check that, but was wondering if there were a direct framework/windows forms method of determining if Me.Close had already been called.
Thanks.
Tom
|
| | Reply: by:William Ryan eMVP
|
| | If I undertstand you correctly, I'd just add an eventhandler for that forms closing event, and then respond to it from there. That way you know you'll catch it and you won't have to poll for it. If you do it the way you mention, you'll have to check each time you want to do x. INstead just use the eventhandling model so you'll know exactly when it happens and can respond accordingly. This willl still allow you to work in the fashion you mention, it will just provide a lot of additional functionality. -- W.G. Ryan, eMVP
|
| | Reply: by:One Handed Man \( OHM - Terry Burns \)
|
| | Not being totally sure why you want to do this, but if you simply want the form to not be displayed on screen or not, you could trap the close event and do a me.hide, then cancel the close.
--
|
| | Reply: by:Jay B. Harlow [MVP - Outlook]
|
| | Terry, That would be the Closing event, as you can cancel it.
The Closed event itself is too late.
Hope this helps Jay
|
| | Reply: by:One Handed Man \( OHM - Terry Burns \)
|
| | Yes, that was a typo or mindslip, whichever you prefer
Thanks
|
0 Comments:
Post a Comment
<< Home