Accessing mdiParent form menu from mdiChild form via code
-
I have main start up form call MainForm called as follows...
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}On MainForm I have a MenuStrip with MenuItems and ToolStripMenuItems. Some of these ToolStripMenuItems have a property of CheckOnClick set to True. From MainForm I open another form called F1 based on HormoneTypeForm, as an MDI child...
private void hormoneTypeToolStripMenuItem_Click(object sender, EventArgs e)
{
HormoneTypeForm f1 = new HormoneTypeForm();
f1.MdiParent = this;
hormoneTypeToolStripMenuItem.Enabled = false;
f1.Show();
}My question is - from form F1 I want to be able to get and set the Checked value of some of the ToolStripMenuItems on the MainForm menu. I cannot find anyway to reference the ToolStripMenuItems on MainForm from F1. I'm sure it simple but.....? Thanks for any help.
-
I have main start up form call MainForm called as follows...
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}On MainForm I have a MenuStrip with MenuItems and ToolStripMenuItems. Some of these ToolStripMenuItems have a property of CheckOnClick set to True. From MainForm I open another form called F1 based on HormoneTypeForm, as an MDI child...
private void hormoneTypeToolStripMenuItem_Click(object sender, EventArgs e)
{
HormoneTypeForm f1 = new HormoneTypeForm();
f1.MdiParent = this;
hormoneTypeToolStripMenuItem.Enabled = false;
f1.Show();
}My question is - from form F1 I want to be able to get and set the Checked value of some of the ToolStripMenuItems on the MainForm menu. I cannot find anyway to reference the ToolStripMenuItems on MainForm from F1. I'm sure it simple but.....? Thanks for any help.
I'm not sure what this has to do with "General Database" however ... In your
hormoneTypeToolStripMenuItem_Click
you will need to use a reference to your MainForm, either make it global or ensure this method is part of your MainForm. Also note that yourHormoneTypeForm f1
will be destroyed as soon as this method returns; I doubt that is what you want.It's time for a new signature.