namespace CallFunction
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void CallFunction()
{
MessageBox.Show("Test Call Function.");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2(this);
f2.Show();
}
}
}
Form2
namespace CallFunction
{
public partial class Form2 : Form
{
public Form1 f1;
public Form2(Form1 f )
{
InitializeComponent();
f1 = f
}
private void button1_Click(object sender, EventArgs e)
{
f1.CallFunction();
}
}
}