i want that when i click NewToolstripbutton it run active child form newbutton procedure

Note: newbutton is a userdefine Procedure.

Help if any body known

Ammad Iqbal

I dont think its such a hard Question. I am New in C#.
IN Vb i do this in that fashion

Dim FrmChild As Object
FrmChild = Me.ActiveMdiChild
FrmChild.NewButton()

And its work But in C# it generate error on NewButton()

You need to ensure that the MDI Child has a method called NewButton and that the method is declared as Public.

You need to ensure that the MDI Child has a method called NewButton and that the method is declared as Public.

NewButton is a public Method. but i resoled it like this:

try
            {
                FormCollection fc = Application.OpenForms;
                foreach (Form f in fc)
                {
                    if (f.Name == "Frm_Supplier")
                    {
                        ((Frm_Supplier)(f)).NewButton();
                    }
                }
            }
            catch
            {
                Exception Ex = new Exception();
                MessageBox.Show(Ex.Message);
            }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.