We help IT Professionals succeed at work.

RichtextBox Formating in VB6

Medium Priority
Last Modified: 2012-05-11
I am creating a project in VB6.0 in which I am using a RTB (RichTextBox). In this RTB i am opening a RTF File which has multi color Texts. Now I want to Replace the Black Foreground Colored texts into Red Colored Texts. But I dont know how to do it.

Note:- This Black foreground Color is the Default Color. So there is no RTF value like \cf0

My Question is "How to Replace a certain Colored Text into Another Colored in RTB in vb6.0"

Watch Question

Hi John,

  Check the below link


Unlock this solution and get a sample of our free trial.
(No credit card required)


Actually I have solved my problem. But your code is helpful to me. Thanks
I don't think you can locate sections of text by just knowing a font property.
To change the font.color of a section of text, I think you have to first 'select' the section.. That means you have to know why those sections you are referring to are that color. (spelling mistakes or a section the user has manually selected.)
If the text is not thousands of characters, you could scan thru the text one selected character at a time and tabulate a map of the colored sections you are interested in.. Then, from that map, select each section in turn and set its color. (This would be too slow on long text) (Tip.. making a Listbox or RTBox invisible while you perform actions like this greatly speeds up the process.)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.