I’ve got a RichTextBox, and would like to highlight a whole word, given just its starting index.
I’ve been able to highlight a word if the starting index and length is known, however in this case I do not know the length of the word. Is it possible to highlight from a starting index to the first occurance of a space?
UPDATE:
This is what I’ve tried so far:
resultsRichTextBox.Select(novelOffset - 2, searchString.Length);
Unfortunately ‘searchstring’ is not always the length of the word being searched for, so I need a way of finding the amount of characters from novelOffset - 2 till the nearest space.
You can do something like this:
Obviously you can change
char.IsLetterOrDigitwithx != ' 'or whatever you prefer.