1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Rep Power

    VB.Net rich text box font colors

    Hey people,

    I have a program receiving strings of data through the serial port.
    I am needing to display these on a screen (within a text box) but some of the strings need to be different colours.

    Is there an easy way to do this?

    The trouble I am having is that each time I make the new string a different colour everything changes.... so... I have written a function to store the strings and then read through each and determine the colours, but.... this can be very slow, as each time a new string is received the program needs to re-do all the colours of the old ones (otherwise their colour would be incorrect).

    Can anyone help?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Rep Power
    Hi aaronbromley,

    I replied to your other post in the VB section, so I'l re-post here :

    How are you applying the color to the text?

    I had a project a while back that involved formatting text in a rich text box and I remember that I had to select the section of text that I wanted to format first and then apply formatting to it similar to:

    rtbViewOutput.SelectionStart = <some start point>
    rtbViewOutput.SelectionLength = <some length of selection>
    rtbViewOutput.SelectionColor = Color.Red

    I know I had different formatting on different sections of text and I didn't have to re-assign previous formatting.

    Hope that helps!


IMN logo majestic logo threadwatch logo seochat tools logo