Ok, I am pretty new to Visual Basic 2005. I am taking a course in it and we are creating a Department Store program right now. I pretty much have 90% of the program done, its just that when I try and move information as strings (name, province, postal code, etc...) from the first form, to the final form (checkout or invoice) I can never get them to appear there!

I have a module open and this is what I have:

Public fullname As String
Public information As String

I am going to only use the main two as examples.

What I am doing now (this is where I am stuck) is going to the full name text box (txtFullName) and typing this in for code:

fullname = txtFullName.text

Once I do that I go to my last form and I put in:

information = txtInformation.text
information = fullname

I don't understand what to do because the fullname never loads into the text box when I go to the last form. I need to use variables too because I have much more information that needs input.

Really appreciate it if someone could help me!

Extra info: I have 3 forms, the personal info, which has a button that moves to the ordering stage, which then moves to the final stage by a button.

I don't want anything to get too complicated like I have made it by experimenting TOO many times with different methods (none of which have worked).

I know this has a very simply solution but I am the worst at variables :S.

Thanks for reading.

Recommended Answers

All 5 Replies

Ok, I am pretty new to Visual Basic 2005. I am taking a course in it and we are creating a Department Store program right now. I pretty much have 90% of the program done, its just that when I try and move information as strings (name, province, postal code, etc...) from the first form, to the final form (checkout or invoice) I can never get them to appear there!

I have a module open and this is what I have:

Public fullname As String
Public information As String

I am going to only use the main two as examples.

What I am doing now (this is where I am stuck) is going to the full name text box (txtFullName) and typing this in for code:

fullname = txtFullName.text

Once I do that I go to my last form and I put in:

information = txtInformation.text
information = fullname

I don't understand what to do because the fullname never loads into the text box when I go to the last form. I need to use variables too because I have much more information that needs input.

Really appreciate it if someone could help me!

Extra info: I have 3 forms, the personal info, which has a button that moves to the ordering stage, which then moves to the final stage by a button.

I don't want anything to get too complicated like I have made it by experimenting TOO many times with different methods (none of which have worked).

I know this has a very simply solution but I am the worst at variables :S.

Thanks for reading.

Try to switch the sequence of these lines

from:

information = txtInformation.text
information = fullname

to:

information = fullname
txtInformation.text = information

What method are you using to set the "fullname" variable. is this through a click event of say a button? or a keypress event from the textbox?

If there is no button event and there is no "keypress" event tied to the textbox, then how are you setting the variable "fullname"

heres what i think u r looking for,
you want data that u received from form1 controls should be transfered to form3 on click event of button say ORDER.
if its so then the code is like:

Module code:
Public fullname As String

form1 code:

Private Sub btnORDER_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnORDER.Click
fullname = txtf1tbox.Text
form2.show()
End Sub

from2 code:
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = fullname
End Sub

I'm not sure if this is the right approach but surely you would need to use this syntax:
Form1:

Dim fullname as string
fullname = TextBox1.Text

Form2:

TextBox2.Text = Form1.fullname

I hope that this helps/makes sense. Also please let me know if this is a bad approach to use because I am still learning myself.
ParkeyParker

Try:

Module1.fullname = txtFullName.text

and every time you refer to something thats public in another form or module put the name of it before the variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.