Is form closed?

  • Thread starter Thread starter Tom
  • Start date Start date
T

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
 
Tom said:
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.
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.
Thanks.

Tom




--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
 
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.
 
Terry,
That would be the Closing event, as you can cancel it.

The Closed event itself is too late.

Hope this helps
Jay
 
Yes, that was a typo or mindslip, whichever you prefer

Thanks

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
 
Back
Top