Solved

I know this is a simple text box question

Posted on 1998-10-28
5
157 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
ID: 1442057
oh, this is VB5
0
 
LVL 2

Expert Comment

by:dabellei
ID: 1442058
You got it but you inverse it

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

carriage return and line feed
0
 
LVL 3

Author Comment

by:groone
ID: 1442059
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
ID: 1442060
How about using this key word

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

Expert Comment

by:fguerreiro_inix
ID: 1442061
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

856 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