Consider two forms: form1 and form2
form1 calls form2:
form2 frm = new form2()
frm.show
form2 shows a grid with data. When data is selected, it’s put into a textbox.
I need the return value from form2 to form1 when it’s closed.
How can this be done?
Add a
publicproperty to yourForm2class that returns the selected item.Then, replace the
Show()call withShowDialog()(a blocking method) and check the property afterwards.Also, rename your forms.