I have a few (1-3) user controls on my form. I want to be able to click a button on my form (that is not part of the user controls) and have all 3 of my user controls respond. How can I do this?
+3
A:
If I understand you correctly, this is all you need to do; just add a public method to your user control and call that method from your button press:
protected void Button_Click(object sender, EventArgs e)
{
UserControl1.DoMethod();
UserControl2.DoMethod();
UserControl3.DoMethod();
}
public class YourUserControl : UserControl
{
public void DoMethod()
{
// Show your ListBoxes
}
}
GenericTypeTea
2009-11-10 09:07:55
+1, was going to post the same answer.
Sorin Comanescu
2009-11-10 09:08:51
Thanks! And now I feel like an idiot! This is what happens when I stay up all night.
Bob Dylan
2009-11-10 09:10:19