To pass value parent form to child form you need to pass a value from parent form as a parameter
and need a public method in child form as follows
from parent form :
mychildform newchild=new mychildform(myvalue) ;newchild.showdialog() ;
here i have pass a value from parent to child as parameter . we need to take one arguments when initialized child form .
public string globalvalue ;public mychildform(string initialValue){InitializeComponent();ValueFromParent = initialValue;}
then we need method to recieve the value
public string ValueFromParent{set{globalvalue= value;}}
Now You will get parent value to child form as name of globalvalue string variable .
No comments:
Post a Comment