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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

carrage return within a textbox

Status
Not open for further replies.

guitar2

Programmer
Jan 20, 2002
5
0
0
US
I am trying to add text to the next line in a textbox but don't now how to insert a carrage return so it writes the new text on the same line.

how it looks:
Current text new text

what I want:
current text
new text

any suggestions.
 
Set multiLine=true for the box at design time.
To add to the end of the text.
txtbox.SelStart = 65535 ' get to end of text
txtbox.seltext = vbcrlf & strNewText ' add carriage return
Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
something a little less confusing:

PrivateSub Command1_Click ()
Txtold.Multiline = True
Txtold.Text = Txtold.Text & vbCr & txtnew.text
End Sub

See if this works.
 
Less confusing, slower and it will not work.
Multiline is Read-only at run-time which is why I said set it at design-time. What is the point of extracting text to a temporary string just to put it back into the textbox. Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
I'm sorry about writing that code. The format works for message boxes, and I assumed that it would work for textboxes.
I just tried it and it doesn't work.
Sorry.
 
the post above was written by me (Reptile 387) my account got switched with his somehow. i'm still trying to figure it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top