On the internet to find a lot of columns, some do not understand, some too troublesome.
Now there are two ways to be simple and practical, to share to everyone!
First: Use the constructor to pass a value
1. Create a new constructor for the child page
1 PublicChildwindowtest (stringtexts)2 {3 4 InitializeComponent ();5 //the value passed by the parent class .6 This. Text1.Text =texts;7 }8 9 //texts is the value passed from the parent page.
2. Parent Page object that creates a child page
1 // you need to pass a value in the ChildWindow constructor 2 New Childwindowtest ("ChildWindow Usage: Parent page, sub-page mutual value ");
3, the sub-page constructor parameter texts is "ChildWindow Usage: Parent page, sub-page mutual value"
The second type:
1. Define a method on the sub-page
1 Public void UPDATETEXT (string2 {3 tbname.text = Str; 4 }
2. Create a child Page object on the parent page
1 New Childwindowtest ();
3. How to invoke a child page when the child page is facing the parent page:
1 childwindow.updatetext ("ChildWindow Usage: Parent page, sub-page mutual value ");
In the method UpdateText (string Str) of the child page, you can manipulate the passed value.