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

TextBox placing data in and then moving to next line

Status
Not open for further replies.

HebieBug

Programmer
Jan 8, 2001
354
0
0
JP
Have a textbox which pulls data from a database.
If it is displaying a field with the names:
SAM
JOHN
Peter
At present te text box will read
Sam John Peter
What I'm really after is the program to put a return Key after each entry so it is displayed as
Sam
John
Peter
Does anyone know the ASCII code for the return key and how it is meant to be entered into the code

 
Hi,

When you get each field back from the database append a carriage return/line feed (vbCrLf) to the string e.g.:

text1.text = text1.text & strDatabaseData & vbCrLf

Do this for each item you retrieve from the database.

Cheers,

Madlarry
 
Also note that vBcRLF is a VB built-in shortcut for

char(13) & char(10) (carriage return + line feed)

e.g:

Code:
text1.Text = "a" & VbCrlf & "b"

gives output:

a
b

don't forget to set the text1 multiline property to true

the line of code:
Code:
text1.Text = "a" & chr(13) & chr(10) & "b"

will give the same output
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top