Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C++ Libraries / April 2005

Tip: Looking for answers? Try searching our database.

How to know instance of form open?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Poewood - 15 Mar 2005 05:19 GMT
Is there a way to find out if an instance of a form is open?  I have created
a .net usercontrol that is attached to a main form.  The control opens up
another form. I would like to close it from the control that initiated it.

Thanx,
Poe
Alon - 09 Apr 2005 22:34 GMT
> Is there a way to find out if an instance of a form is open?  I have created
> a .net usercontrol that is attached to a main form.  The control opens up
> another form. I would like to close it from the control that initiated it.
>
> Thanx,
> Poe

Hi Poewood
I can see two easy way, and one a little bit complex. You can keep a
reference to the Form, and whenever you need to know if it is
displayed, just check its Visible property. Or if you need to know when
it is closed, you can register a delegate to an event such as the
Disposed event. The more complex method is to use the FindWindow or
EnumWindows native API (using platform invoke) and to search the needed
form, then you can create a Form object around the handle that you have
received.

Alon Fliess
CTO
The Sela Group

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.