Hello. I am working on a GUI that has two forms (Form1 & child). I have two global variables on the forms to use to pass data between them. When a button is clicked on Form1, child pops up and data is passed to its global variable. When a button is clicked on child, I want to pass some data back to Form1. How do I do that?
Ex.
Form1:
Form2 child = new Form2();
public string imagePath;
private void btn_Click(object sneder, EventArgs e)
{
child.path = imagePath;
}
child:
public string path;
private void btn_Click(object sneder, EventArgs e)
{
(Form1 global variable) = path;
}
How do I correct the method in the child form?
Loading
Sam HobbsPosted Aug 2, 2010, 1:46 PM
All of that is a bit more complicated than it needs to be becasue you have "Form2 child" as a member of the form1 class. If you make "Form2 child" as local to the click event in form1, then it would be easier.
Tanmay SarkarPosted Aug 1, 2010, 1:40 PM
I upload a file for your help.
Here A value will send from parent to his child & also a value will send child to his parent.
Note that the parent's textbox modifier is Internal.
Hope it help you!
Thank you!
Please mark it as an answer if it help you!