Reputation: 11
I'm trying to call a button which is in a form via a class1. So in my Form I have:
public LoadSettings loadSet; //refering to a class2
and a button event:
public void loadSettings_Click(object sender, EventArgs e)
{
loadSettingsClicked = true;
var loadSet = new LoadSettings(this);
loadSet.load_settings(sender);
}
So it's a button which calls a method in a class2 and executes something. Now I'm in a class1 and I want to call this button from there. In this class1 I have:
public Form1 form1 = null;
public Class1(Form1 frm1)
{
form1 = frm1;
}
and now I want to call the button from there:
form1.loadSettings_Click(this);
but he doesn't want. He recognizes the form etc but how do I call the button?
Upvotes: 1
Views: 1739