I have 2 forms. One is the display form and the other is the where data is added to an array.
How do I start a function on the display form once the ok button has been clicked on the add to array form?
EDIT:
Let me rephrase. How would I go about calling a function that is in one .cs file, from another .cs file.
Form 1
private void menuItem1_Click(object sender, EventArgs e)
{
Form2 form2= new Form2();
form2.Owner = this;
form2.ShowDialog(this);
}
Form 2
private void button1_Click(object sender, EventArgs e)
{
Form1 form1 = new Form1();
form1.myMethod();
}
Obviously, the form2 code is generating a new instance of form1.
How do I run the method of the form that opened the modal window?
Thanks
The owner of
Form2is a instance ofForm1so you can cast the owner toForm1and call the method: