Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo
Is form closed? (Monday, January 02, 2006)
 

Found the following interesting discussion in the Newsgroups:

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



Posted by Xander Zelders



 
Previous Posts
    - Determine if property exists at runtime?
    - How to convert VB6 Type To .NET Structure
    - How to create a suimple virtual directory with def...
    - Multi column listboxes
    - Unicode to MS-DOS Cyrilic (code page 866)
    - Vb.net 2003 Get Text File
    - Program upgrades
    - RE: SQLCE Problem on Create Table
    - Q:Importing an Excel file into a VB application
    - Vb.net 2003 Get Text File

Archives
    - 10/03/2004 - 10/10/2004
    - 10/10/2004 - 10/17/2004
    - 10/17/2004 - 10/24/2004
    - 10/24/2004 - 10/31/2004
    - 10/31/2004 - 11/07/2004
    - 11/21/2004 - 11/28/2004
    - 11/28/2004 - 12/05/2004
    - 12/05/2004 - 12/12/2004
    - 12/12/2004 - 12/19/2004
    - 12/19/2004 - 12/26/2004
    - 12/26/2004 - 01/02/2005
    - 01/23/2005 - 01/30/2005
    - 01/01/2006 - 01/08/2006
    - 09/24/2006 - 10/01/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland