Click to See Complete Forum and Search --> : changing the color of known words


meirgold
September 2nd, 2001, 03:16 PM
hello all

I wanted to know, how to change the color of certain words in a rich text-box when a the user finishes to type the word (as in the VB editot where words like "end sub" are colored)

pleeease help

Meir

DSJ
September 4th, 2001, 08:13 AM
You'll have to write code to find the words who's color you want to change, set the selStart and selLength properties so that this text is selected and then use the SelColor property... similar to...


private Sub Test()
RichTextBox1.SelStart = 1
RichTextBox1.SelLength = 10
RichTextBox1.SelColor = vbRed
end sub

phil edney
November 26th, 2001, 08:35 PM
Trouble with this is that it highlights the word and if you immediately set the the sellength back to zero it will flicker.
Is there a more direct method, like using SendMessage(..) based on the current cursor location in the Richtextbox, that does not involve selecting the word ?