I'm trying to highlight all instances of words in a rich text box. I have been using the find method, but that finds the first instance.
I would like to start the first search at startPos = 0, then when I find an instance, start the new search from the last char of the found instance i.e.
newStartPos = (rtb.Text.IndexOf(text, type) + rtb.Text.Length);
any ideas...
Basically I need to find all instances of words in a list container as the user types into a richtextbox, for every 开发者_开发知识库hit I change the word colour within RTB and then do some maths on the chars within the complete RTB depending on the number of hits
Use the overload string.IndexOf(string, int)
, as startIndex
you use lastFoundIndex + 1
精彩评论