C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Call a method in Active MDI Child Form from the MDI Parent


Posted Date: 07 May 2007    Resource Type: Code Snippets    Category: Application windows, menus & toolbars

Posted By: Balamurali Balaji       Member Level: Diamond
Rating:     Points: 10



This code is used to call a method defined in a MdiChild form which is currently active in an MDI application.

To test run this code, create a MDI windows forms application with two forms, one parent and another child.

Add a new method in the child form, Form2


public static void display()
{
MessageBox.Show("Child Form Method");
}


Create a delegate object in the class Form1 with matching signature as that of the method defined in Form2.


delegate void InvokeDisplay();



On click of a toolbutton in a ToolStrip or menuitem in a MenuStrip of Form1, add the following code to call the above method.


private void toolStripButton2_Click(object sender, EventArgs e)
{
this.ActiveMdiChild.Invoke(new InvokeDisplay(Form2.display));

}






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Prevent opening of multiple instances of same child form from MdiParent
Previous Resource: Search Node in a TreeView
Return to Discussion Resource Index
Post New Resource
Category: Application windows, menus & toolbars


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

SPOC

Contact Us    Privacy Policy    Terms Of Use