MDI Children

Cassio

Well-known member
Joined
Nov 30, 2002
Messages
276
Location
Rio de Janeiro
How can I know if a MDI Child is already openned? I want the user to click an icon on the MDIParent menu and if the MDIChild is already openned it just get the focus instead of opening another MDIChild.

Thanks.
 
Theres no built in way to do this like there was in VB6 (or previous versions). You can define a form-level variable in your MDI parent form. When the user clicks the button, check if the variable is Nothing (or null in C#) then create the form and show it. If its not Nothing, just show the form.

There are other options, like using a static method of the child form to have IT control the one an only one instance. Its the same concept, but youd call the static method of the child class which would instantiate a static variable (if not already Nothing or null) and show it.

-nerseus
 
Back
Top