1
I am developing a system with MDI forms. I have a menu that is the MdiParent
and everyone else is allocated as your children.
Originally, MDI allowed me to open the same form several times; then I started to control the existence of the forms through a static statement, thus:
public static Form form1;
When opening the form:
if (form1 != null)
{
form1.Activate();
}
else
{
form1 = new TED_Dados();
form1.MdiParent = this;
form1.Show();
}
And finally, when I close the form:
Menu.form1 = null;
This code is functional, but it is necessary to replicate it to all forms, and I need all of them to be declared in the menu. I would like to know if there is any solution that would allow me to control all forms through a single class or method.
Menu
is what? The parent form (MDI)?– Jéf Bueno
Advice I give you to understand more about this: Create an MDI from the Visual Studio template, observe the code that is generated. You’ve got enough on your plate to work with Child of the MDI.
– Thiago Araújo