Dynamically highlighting items in a rich textbox

  • Thread starter Thread starter Fool
  • Start date Start date
F

Fool

Hi,

I want a rich textbox that dynamically highlights particular words
immediately after they are typed. Just looking for some general
tips...

I tried putting some code in a sub that handles the textchanged event
for that textbox. The issue here is that the focus jumps to the words
to be highlighted (naturally, I suppose, since my technique is to
search for specific words, select them, and highlight them). But I
need to get the words to highlight without moving around the caret,
thus interfering with the user's attempt to type!

Any suggestions? Thanks!!!


Fool
 
Someone correct me if i'm wrong ;)

if you want to test on full words you could use the keypress event to test
on spaces and execute your code there (this would improve performance)
for to let the user continue typing you'll have to select the end of the
text. to prevent the user from typing in the middle of the text while you
are doing your thing you could set a boolean flag when you start your thing
and intercept the keys in the keypress event.
if you want the user to be able to continue when you are doing your thing
use the previous technique and instaid of ignoring the keys in the keypress
event store them in a string and add that string to the text when your thing
is finished.

i hope this is understandable :)

eric
 
Thanks to both of you! I'll check out tutorial, but the first
suggestion also seems very sound.
 
For what it's worth, the link leads to an interesting-looking open
source project... but I don't see the tutorial...?
 
Back
Top