That should work fine for you. Change the type for the somevalue varibles to object instead of string. So basically put a 'Public Property' of the type you want returned on form B. before you call '.Dispose' on the form B the value will still be accessible through the property even though your user has closed the form. So set the value to a member in form A, then dispose of the other form and continue your processing.
Also it is better to use the actual object's type instead of the 'Object' type. Using 'object' requires the code to dynamically type the objects at runtime (late-binding), which can reduce performance and open your code to errors since the type is not known by the compiler when compiled.
: : something like thisin form 1?
: : Dim l_form2 as form2
: : dim l_SomeValue as string
: : l_Form2.SomeValue = "if you want to pass something in"
: : l_form2.showdialog()
: : l_SomeValue = l_form2.SomeValue
: : l_form2.dispose
: : 'form 2
: : Public Class Form2
: : Dim m_SomeValue as String
: : public property someValue
: : 'what you get return
: : Get
: : Return m_someValue
: : End Get
: : 'if you want to set before form2
: : Set(ByVal Value)
: : m_someValue = Value
: : End set
: : End Property
: : '''
: : ~rlc
: Thanks for your response but Im not too sure that this will work for me.
: Basically, in Form A I want the user to specify a Supplier.
: Form B holds a datagrid with all the suppliers.
: The User Clicks on the "Specify" Button which will open form B displaying the "Supplier" datagrid.
: The user selects a Supplier from the datagrid and clicks OK.
: I can get the relevant info out of the grid using the following code :
: "Dim supplierIDcol As Integer = 0
: Dim val As Object = Me.DataGrid1(Me.DataGrid1.CurrentRowIndex, supplierIDcol)"
: I Need to pass Val back to form A.
: Thanks for your help so far!