I can't figure out how to do this using VB.Net... I was able to do it using VB6:
I have two forms (form1 and form2). Form1 has a button that opens Form2 (on top of Form1). The user clicks on a value in a flexgrid on Form2, and I want Form2 to close, and the value they clicked on to be populated in a grid that I have on Form1. I couldn't find out how to reference the form1 and it's flexgrid from form2 without having to create a new instance of Form1 (dim Form1 as new Form1), which is not what I want. I want to put the value on the original Form1.
Can anyone help

Referencing another form
zhackwyatt
mosaic
Adrian Accinelli
Dim frm As New Form2
frm.ShowDialog()
Me.TextBox1.Text = frm.NewValue
frm.Dispose()
And that should be all you need. In this case, you wait for the user to close Form2, and when that happens, you retrieve its NewValue property, then Dispose it. Works here...
Tomcatter
Setup a Property on your Form2 that can hold a reference to your instance of Form2, so you can do whatever you'd like with Form1 from Form2. Something like this should work.
<b>'Inside Form 2</b>
Private _Form1Reference As Form1
Public Property Form1Reference As Form1
Get
Return _Form1Reference
End Get
Set (ByVal Value As Form1)
_Form1Reference = Value
End Set
End Property
<b>'Inside your Button Click Event that launches Form2 from Form1</b>
Dim Temp As New Form1()
Temp.Form1Reference = Me
Temp.ShowDialog()
<b>'Inside whatever event fires where you want it to affect Form1 from Form2 and close itself</b>
'this is just an example...do whatever is necessary to Form1 by accessing the Form1Reference Property we created earlier
Form1Reference.SomeProperty = "blah"
Me.Close()
Hope this helps :)
JDigital007
Thank you so much. I ended up using Erik's suggestion and it worked perfectly. You saved me from having another nightmare day :) Thanks again.
Diane
Xcalibur37