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

rich text box

Status
Not open for further replies.

Nanda

Programmer
Nov 14, 2000
104
US
how can write my recordset results in a rich text box. line after line reading from RS, and breaking line after each record?

Thanks for any reply.
 
Hi

You can do this by adding vbCrLf (short for Visual Basic Carriage Return, Line Feed) which starts a new line.
Code example below:

do
RichTextBox.text = RichTextBox.text & _
rs.fields("forename") & _
rs.fields("surname") & _
rs.fields("salary") & _
rs.fields("NI number") & _
vbCrLf
rs.movenext
loop until rs.eof = true

Just out of curiosity - why do you want to add records to
a rich text box - wouldn't a grid control (or dynamically added controls) give better layout and functionality?

Kate
 
Thanks Kate

above code does work for me, but it flickers. it does not look like appending the text as rtf.text is always updated with rtf.text & newtext. how should I stop flickering it and making more readable while recordset is still in loop of writing richtext?

for your curiosity, I want to display some specific fields, reading from large database. Definitely grid is a better option to go for, but i need to report some analysis reading from recordset.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top