Appending text to a RichTextBox control

Posted on 2003-03-10
Medium Priority
Last Modified: 2013-12-25
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.
Question by:jam8b
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

Smallint earned 150 total points
ID: 8109804

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

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


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 13 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question