R
RickL
Hi,
Suppose I create a Windows Form app and then add a public method
like this:
class Form1 : Form
{
// Constructors, etc.
public void DoSomethng()
{
}
}
Now I add a UserControl to the form, add a button to the UserControl
and a Click handler for the button.
Question:
When I click the button, how do access the DoSomething() method
in the Form1 class?
I tried this in the UserControl, but the DoSomething() method is not
visible.
private void button1_Click(object sender, EventArgs e)
{
this.Parent.DoSomething(); ???? the method is not visible.
}
Thanks for any help.
RickL
Suppose I create a Windows Form app and then add a public method
like this:
class Form1 : Form
{
// Constructors, etc.
public void DoSomethng()
{
}
}
Now I add a UserControl to the form, add a button to the UserControl
and a Click handler for the button.
Question:
When I click the button, how do access the DoSomething() method
in the Form1 class?
I tried this in the UserControl, but the DoSomething() method is not
visible.
private void button1_Click(object sender, EventArgs e)
{
this.Parent.DoSomething(); ???? the method is not visible.
}
Thanks for any help.
RickL