How do I check to see if a child form is already displayed so I don't have two instances showing?
Here are two ways you can do this.
Within the parent MDI form, use code such as this:
ii) Here is a second solution suggested by John Conwell that implements a singleton pattern on the child form.
In the MDI Child form put this code in (where frmChildForm is the MDI child form you want to control)
In the Parent MDI form use the following code to call the child MDI form
The first time this code is called, the static GetInstance method will create and return an instance of the child form. Every other time this code is called, the GetInstance method will return the existing instance of the child from, stored in the static field childForm. If the child form instance is ever destroyed, the next time you call GetInstance, a new instance will be created and then used for its lifetime.
Also, if you need constructors or even overloaded constructors for your MDI Child Form, just add the needed parameters to the GetInstance function and pass them along to the class constructor.