I have several child forms but they have one common methods in them, get_CurrentClamp()
. i want to call the method of the current active mdichild from the MDI parent.
This is the onclick event of a menuitem in the MDIparent form MDIMain.cs that should call the method.
....
private void mnugetCToolStripMenuItem_Click(object sender, EventArgs e)
{
if (MdiChildren.Any())
{
Form f = this.ActiveMdiChild;
f.get_CurrentClamp(varCurrentThreshhold);
}
}
.....
In the child form frmDashboard.cs
public void get_CurrentClamp(float curThreshhold=5.5)
{
...
}
But i keep getting an error, any where am going wrong? Any help will be greatly appreciated!
the error a getting is this
Error 3 'System.Windows.Forms.Form' does not contain a definition for 'get_CurrentClamp' and no extension method 'get_CurrentClamp' accepting a first argument of type 'System.Windows.Forms.Form' could be found (are you missing a using directive or an assembly reference?)
Thats the error am getting on the mdiparent form.