Say you need capture an event for a control in a User Control and you are not permitted to change the control itself.
You can hook into control events, even for private controls with this code:
ComboBox cbo = (customUserControl.Controls["cboSomePrivateControl"] as ComboBox);
cbo.SelectedIndexChange += new EventHandler(cbo_SelectionChange);
...
void cbo_SelectionChange(object sender, EventArgs e)
{
}
It's that easy.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)