I am trying to pass information to parent form from modal form in vb.net winforms application.
1.) I created a copy of a form and displayed it using following code.
dim f=new frmParent()
f.show()
2.) Depending on conditions a button on frmParent opens a modal child form and asks for some informations. I used following code for that:
dim f = new ChildForm()
f.showDialog()
Both code works fine. When user press saves in child form i need to close childForm and use the user types values in parent form. I know how to close the childform but not sure how to pass info from childform to parent form.
Have a public property on your childForm
Public Property MyData As MyType
Then when you show the form you can do
dim f as new ChildForm()
If f.showDialog = DialogResult.OK Then
Data = f.MyData()
End if
If you need to allow them to be able to edit that data again then you might also want to consider passing in the Data to the constructor of the dialog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With