Hi,
I have an C# MDI application. There are three mdi childs, mdiFormA, childB and childC. childA is loaded in the parent by default as below:
private void TestingMenu_Load(object sender, EventArgs e)//mdiParent load
{
mdiFormA objA = new mdiFormA();
objA.MdiParent = this;
objA.Show();
//this.formAToolStripMenuItem.Enabled = false;
}
mdiFormA can also be opened from the menustrip menu as:
private void formAToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!menuEnabler.ParentIsActive)
{
mdiFormA objA = new mdiFormA();
objA.MdiParent = this;
objA.Show();
//this.formAToolStripMenuItem.Enabled = false;
}
else
{
//this.formAToolStripMenuItem.Enabled = true;
}
}
Similarly mdiFormB and mdiFormC can also be opened from the menu_clicks.
What I need to do is when the application is launched and mdiFormA is successfully loaded, the menu item to open mdiFOrmA bcomes disabled and at this instant menu items for childs A and B becomes enabled. When mdiFormA is closed/disposed, the menu item to open mdiFormA becomes enabled but the menu itms to open mdiFormB and mdiFormC becomes disabled.
I have tried to implement this mechanism by making all the menus of parent public and then doing something like this in mdiFormA:
TestingMenu obj = new TestingMenu();
obj.formAToolStripMenuItem.Enabled = false;
obj.formCToolStripMenuItem.Enabled = true;
obj.formCToolStripMenuItem.Enabled = true;