Text box help!

Massey1337

New Member
Joined
Mar 8, 2009
Messages
17
Okay, hi again, basically this is a shop till like program, you press load form 2 once the program starts, you enter product, quantity, price of product and it'll calculate a total for you, once this happens you'll click the close button and it'll transfer the data to the text box in my form 1, and then you can go back to form 2 and repeat the process.
I have multiple sets of data being recorded in my text box in form 1 however; I can't work out how to get onto the next line in the text box, it's just grouping the 2 sets of data together without even a space.
If you need any more information, just say so, I'd really appreciate some help on this project, thank you. :)

Form 2 v

Dim X As Double
Dim Y As Double
Dim Z As Double
Dim Newinfo As String

Private Sub CloseF2_Click()
Newinfo = Form1.Text1.Text + Chr$(10)
Newinfo = Newinfo + Text1.Text + " " + Text2.Text + " " + Text3.Text + " " + Text4.Text
Form1.Text1.Text = Newinfo
Form2.Visible = False
X = Form1.Text2.Text
Y = Text4.Text
Z = X + Y
Form1.Text2.Text = Z
Text1.Text = ""
Text2.Text = "0"
Text3.Text = "0"
Text4.Text = "0"
End Sub

Private Sub Form_Load()
Form2.Visible = False
Text1.Text = ""
Text2.Text = "0"
Text3.Text = "0"
Text4.Text = "0"

End Sub

Private Sub Text2_Change()
If Text2.Text = "" Then

Else: X = Text2.Text
Y = Text3.Text
Z = X * Y
Text4.Text = Z
End If
End Sub

Private Sub Text3_Change()
If Text3.Text = "" Then

Else: X = Text2.Text
Y = Text3.Text
Z = X * Y
Text4.Text = Z
End If
End Sub

Form 1 v
Private Sub Command1_Click()
Form2.Visible = True
End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
try adding a vbcrlf in between strings

like:

bigStr = smallStr1 & vbcrlf & smallStr2 & vbcrlf & smallStr3
 
Upvote 0
Newinfo = Newinfo & vbcrlf + Text1.Text + " " + vbcrlf Text2.Text + " " + Text3.Text + " " + Text4.Text
Just like that? And only for that line?
Sorry, I'm a new programmer, I'm just trying to get grasps with it. =/
 
Upvote 0
maybe

Code:
Newinfo = Newinfo & vbcrlf & Text1.Text & vbcrlf & Text2.Text & vbcrlf & Text3.Text & vbcrlf & Text4.Text

vbcrlf is a built in string variable that contains a CR (carriage return or ascii 13) and a LF (line feed or ascii 10) that sets the printing cursor to the beginning of the next line down
 
Upvote 0

Forum statistics

Threads
1,213,549
Messages
6,114,261
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top