The ActiveMdiChild property is of type Form, so you need to cast it as the correct type so you can call methods of that type. Let's say you have two form classes, named ChildForm1 and ChildForm2, that you create instances of. You might have a method named DoSomething in each class that may or may not do the same thing. If you want to call the appropriate method when the DoSomething button is clicked on the toolbar you would do something like this:Code:private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { if (e.Button == this.doSomethingButton) { Type activeChildType = this.ActiveMdiChild.GetType(); if (activeChildType == typeof(ChildForm1)) { ((ChildForm1)this.ActiveMdiChild).DoSomething(); } else if (activeChildType == typeof(ChildForm2)) { ((ChildForm2)this.ActiveMdiChild).DoSomething(); } } }




Reply With Quote