Solved

I know this is a simple text box question

Posted on 1998-10-28
5
145 Views
Last Modified: 2010-04-30
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.
0
Comment
Question by:groone
5 Comments
 
LVL 3

Author Comment

by:groone
Comment Utility
oh, this is VB5
0
 
LVL 2

Expert Comment

by:dabellei
Comment Utility
You got it but you inverse it

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

carriage return and line feed
0
 
LVL 3

Author Comment

by:groone
Comment Utility
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 mousePT As POINTAPI
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
0
 
LVL 18

Accepted Solution

by:
deighton earned 50 total points
Comment Utility
How about using this key word

    Text1 = Text1 & vbCrLf & "hello Fred"
0
 
LVL 3

Expert Comment

by:fguerreiro_inix
Comment Utility
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
Regards

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now