المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Event handling in a custom control.



C# Programming
06-21-2009, 03:50 PM
Hi All,

I have a composite(custom) control in which I have a button control (call it button1). In the control I have coded for the button click event. i.e. inside the method:
private void button1_Click(object sender, EventArgs e)
{
//My functionality here
}
This control will be used by some other application developer.
The requirement demands the functionality that I have impelemented though my code in the button click event handler be overwritten by the developer who will be using my control in his application iff he wishes so or else the functionalty would persist.
The problem that I am facing is how to access the button click event handler in the cutom control from the application that is hosting the control. Making the event handling method public would be a bad work around. I believe I am missing on a concept.
Any guidance will be appreciated.

Best Regards,
Sid