Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Going to next line in textbox

Status
Not open for further replies.

demoniac

Programmer
Joined
Jun 14, 2001
Messages
63
Location
US
Hello. I'm putting output to a textbox just to show what's happening in my program. I want to be able to keep the old text in the box, and also go to a new line. I can keep the old text just by :

testbox.text = testbox.text & &quot;<new text>&quot;

And I thought that to start it on a new line I could go

CR = chr$(13)
testbox.text = testbox.text & &quot;<new text>&quot; & CR

But that doesn't work, it just puts a | in there and keeps writing in the textbox where it left off. (btw, the multiline property is enabled for the textbox).

Anyone have any ideas?

Thanks,
demoniac :o)
 
Use vbCrLf. And save yourself some time with SelStart.
Text1.SelStart = 65535 ' resets to actual #
text1.SelText = vbCrlf & Newstuff

LOOK OUT for exceeding 65535.
 
Fantastic, thank you very much :o)
 
I think this will work for you.
I use this method for rewriting log information to a text box this way I always see the most current first.
This will move all in the text box down and add the new on the first line.

Dim sTemp as string
Dim sNew as string

'This puts the text1.text into the temp string
sTemp = &quot;&quot;
sTemp = text1.text
'This holds the new info you want to be on the top of the
'text box
sNew = &quot;The new info&quot;
'This will add the new first and then the old
'back to the text box
text1.text = sNew & vbCrLf & sTemp


Hope this will work.

Stick it in a loop if reading information into the text box.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top