• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 377
  • Last Modified:

Appending text to a RichTextBox control

I'm trying to use a RichTextBox to log the results of a database maintenance tool. What I am looking for is a function that will append text to the end of the control that can make the text a given color, bold, italic, etc...  For instance I would like to have the category headings in bold and any errors logged in red as the tool is running.

I've tried using rtb.Text = rtb.Text & newString, and then selecting and formating the new string, but this will wipe out the previous formatting.

I've been moderately successful using the TextRTF property to make the text bold, but I haven't been able to get it to display the text in different colors.
0
jam8b
Asked:
jam8b
1 Solution
 
SmallintCommented:
Try

RichTextBox1.SelColor = vbRed
RichTextBox1.SelText = "Hello" + vbCrLf

RichTextBox1.SelColor = vbGreen
RichTextBox1.SelText = "RichTextBox" + vbCrLf

Regards
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now