Click here to Skip to main content
16,014,568 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
I Created a custom control which has Two buttons on a panel.The event handler for the "click" event on the Button1 and button2 are also implemented.
But now the Custom Control Dll is used in an application.When the button1 is clicked..I want a Label_1 in the Form_1 to be populated with a value entered in Text Box_1.But this code cannot be added in the event handler in the Custom Control Library as the custom control is unaware of the controls on the Form_1.

Any help is greatly appreciated as to modify the event handler of the custom control and to use it in the Windows Application which uses it.
Posted

I am new to C#..But How to fire a Custom Event?
 
Share this answer
 
Expose two events, Button1Clicked and Button2Clicked. Handle the both button clicks in your control and fire these custom events. On the application, people can subscribe to this event and they get notified.
 
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