tags:

views:

26

answers:

2

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?

+2  A: 

Add a public property to your Form2 class that returns the selected item.

Then, replace the Show() call with ShowDialog() (a blocking method) and check the property afterwards.

Also, rename your forms.

SLaks
it's works!!! Thank's
A: 

I agree wih SLaks. Here is an example.

Saif Khan