I am trying to get access to Form1’s public method on another form Form2 as below. I have a textbox6 control on form1 and there is public method to bind it. But
Also you may use events:
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.ButtonClickAction += f2_ButtonClickAction;
f2.Show();
}
void f2_ButtonClickAction()
{
amount_sum();
}
Form2:
public Form2()
{
InitializeComponent();
}
public event Action ButtonClickAction;
private void button1_Click(object sender, EventArgs e)
{
Action a = ButtonClickAction;
if (a != null)
a();
this.Close();
}