Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Values from one form to another

Status
Not open for further replies.

jnavarro

Programmer
Dec 1, 2003
89
US
I have researched on passing values from one form to another, however I am unable to find what I am looking for.

I have a main form with information obtain from a SP with a parameter field. The second form is like a search form, which I want to fill in a field in my main form. My goal is to pass the value entered in the second form back to a textbox in the main form.

here is what i try to do and it is not working. When I step thru the code I see the field has changed however, the form does not update.


sub ...
Dim frmtemp As New Form1
frmtemp.TextBox1.Text = TextBox1.Text
Close()
 
You created a NEW instance of Form1 and updated its TextBox1.
If you want to update an EXISTING instance of Form1 then you will have to use a reference to the existing instance. That means that the reference must be passed to the second form.

frmpassed.TextBox1.Text = TextBox1.Text
Close()


Compare Code
 
I am a little confused. How would use the form without creating an instance?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top