Click here to Skip to main content
15,903,203 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a userControl in Windows form application and the usercontrol contain some events and methods in it ,I want raise these Events from the diffrent Parent Forms whose the user control contain it........

and i need to call the methods from the parent forms which the user conrol contain............
any one pls help me........
Thanks in advance......
Posted
Updated 17-Aug-11 0:28am
v4
Comments
Simon Bang Terkildsen 17-Aug-11 3:57am    
one . is enough

Make a public method in your UserControl which invokes an event, then call that method from your form.
 
Share this answer
 
Your question is not clear. I think you want to handle the event in the parent form rather than raise it from the parent form. Posting your code might help. But here is a general guideline.

To handle user control events in the parent form, hook up the control's event to a method in the parent form like this:
C#
private void Form1_Load(......) {
    userControl1.MyEvent+=new EventHandler(UserControl1_MyEvent);
}

private void UserControl1_MyEvent(......) {
    //Do stuff here
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900