That's not exactly clear, but I'll try and explain the various possibilities for what you mean:
You can click the Button in the UserControl and raise an event in the UserControl which refers to the button: just add an event handler in the usual way and the
sender
parameter will contain the Button instance.
You can signal the event from a Button click to the outside world from the UserControl, but you have to create an Event within the UserControl first, and you should pass the UserControl instacne rather than the Button when you raise the event:
public event EventHandler Clicked;
protected virtual void OnClicked(EventArgs e)
{
EventHandler eh = Clicked;
if (eh != null)
{
eh(this, e);
}
}
private void button1_Click(object sender, EventArgs e)
{
OnClicked(e);
}
You can handle your own events within the UserControl (but why you would want to is another thing). Just add a handler for the event you created above in your constructor:
Clicked += new EventHandler(MyUserControl_Clicked);
...
}
void MyUserControl_Clicked(object sender, EventArgs e)
{
...
}
If this doesn't cover what you are trying to do, you need to explain in better detail.