I am trying to return some data from Form2 to Form1, everything seems fine, I got the data and so, but, when I try to pass my data to a textbox, it doesn t changes the text. Only if I open a new instance of Form1, on Form2 it works. Why this happen? Can t I send the text to the old instance?
I m using this code;
Form1 (Main Form)
public void updateText(string data)
{
MessageBox.Show(data);
txtGood.Text = data;
}
Form2 SecondaryForm = new Form2();
SecondaryForm.ShowDialog();
Form2 (Second Form with user data)
Form1 MainForm = new Form1();
MainForm.updateText(data);
MainForm.ShowDialog();
this.Close();
So, my question is, how can I pass the data values to the old instance of the main form? without having to create a new instance and show a new instance. Is there a way to do this?