Pass the event to the main form.
For e.g.
class UControl : UserControl
{
public delegate void ButtonClickedEventHandler(object sender, EventArgs e);
public event ButtonClickedEventHandler OnUserControlButtonClicked;
public UControl()
{
userControlButton.Clicked += new EventHandler(OnButtonClicked);
}
private void OnButtonClicked(object sender, EventArgs e)
{
if (OnUserControlButtonClicked != null)
OnUserControlButtonClicked(this, e);
}
}
Then in your main form, handle this event
public MyForm: Form
{
public MyForm()
{
myControl.OnUserControlButtonClicked += new EventHandler(OnUCButtonClicked);
}
private void OnUCButtonClicked(object sender, EventArgs e)
{
}
}