hi
i have function in mdiparent form and i want to use it in child form.
i created an object reference of parent form in child form and tried to call the function but this didnt worked.
wat should i do??

First of all, C# doesnt have functions, they are methods. I'm on a crusade to eradicate that word from this board ;)

Secondly, how is the method declared, private/public/protected? How have you created your reference to the parent form?

kkk its method..
i declared the method as public in parect form
and used the follwing code to call the method in child form
Form1 ob1 = new Form1();//form1 is parent form
ob1.alllblvis();//alllvlvis is the function

Theres your problem. You arent getting a reference to your original Form1, you are creating a new one.
You need to get a reference to the original form if you want to effect any changes to it:

Form1 parent = (Form1)this.MdiParent;
parent.alllblvis();

You need to ensure you have set the MDIParent of the second form when you called it:

Form2 newForm = new Form2();
newForm.MdiParent = this;
newForm.Show();

hi
i used the second code to make form 1 the parent of the form2 and show it. But the first form in giving an error. its asking for ';' after the 'this' of the first line. i.e. this;mdiparent

Post the code in question, or zip up the project so we can see what is happening.

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.