I know this is a simple text box question

Hi there!  You guys are the best.

I have a text box and I want it treated like a list box in regards to a list box .addItem.  If a global variable differs from what it originally was then it will be added to a new line in the text box.

I have the textbox multiline set to true and a timer interval set to 1

I've tried chr(10) & chr(13) and all I get are black boxes at the end of the new data so in the timer dialogue it looks something like this

text1.text = "This is a new variable = " & newVar & chr$(10) & chr$(13)

but this doesnt create a new line.

I know this has got to be a real simple question to answer I'm just over looking the obvious.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

deightonConnect With a Mentor Commented:
How about using this key word

    Text1 = Text1 & vbCrLf & "hello Fred"
grooneAuthor Commented:
oh, this is VB5
You got it but you inverse it

& newvar & chr(13) & chr(10)

carriage return and line feed
grooneAuthor Commented:
Ive tried that.  Okay, I've worked up a simple program involving a text box,  and cursor postion and basically want I want to happen is the new cursor position be placed on a new line in the text box.  I have multiline set to TRUE in the textbox

Private Type POINTAPI
    Y As Long
    X As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Sub Command1_Click()
Timer1.Interval = 5
End Sub

Private Sub Command2_Click()
Timer1.Interval = 0
End Sub

Private Sub Timer1_Timer()
Dim X As Long
Dim Y As Long
    Call GetCursorPos(mousePT)
    X = mousePT.X
    Y = mousePT.Y
    Text1.Text = "Cursor Position - " & Y & "," & X & Chr(13) & Chr(10)
End Sub
Why don't you try
text1.text = text1.text & "This is a new variable = " & chr$(10) & chr$(13) & newVar

Instead of what you are using
text1.text = "This is a new variable = " & newVar & chr$(10) & chr$(13)

Hope this helps

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.