adamtrask
asked on
Calling a method from a different form
Hi,
I have two forms in a C# application. One called frmMessages and the second frmAdmin.
On the frmMessage form I have a menu called moveToToolStripMenuItem, which I need to make invisible from frmAdmin.
I created the following public method on frmMessages:
public void ShowHideMenu()
{
ToolStripMenuItem item = new ToolStripMenuItem();
item = this.moveToToolStripMenuIt em;
if (item.Visible == true)
{
item.Visible = false;
}
}
In frmAdmin I created a button that calls the above method:
private void button1_Click(object sender, EventArgs e)
{
frmMessage Frm = new frmMessage();
Frm.ShowHideMenu();
}
I need help understanding why this code is not working. Thank you.
I have two forms in a C# application. One called frmMessages and the second frmAdmin.
On the frmMessage form I have a menu called moveToToolStripMenuItem, which I need to make invisible from frmAdmin.
I created the following public method on frmMessages:
public void ShowHideMenu()
{
ToolStripMenuItem item = new ToolStripMenuItem();
item = this.moveToToolStripMenuIt
if (item.Visible == true)
{
item.Visible = false;
}
}
In frmAdmin I created a button that calls the above method:
private void button1_Click(object sender, EventArgs e)
{
frmMessage Frm = new frmMessage();
Frm.ShowHideMenu();
}
I need help understanding why this code is not working. Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER