Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I know this is a simple text box question

Posted on 1998-10-28
5
Medium Priority
?
171 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 150 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

877 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