Inconsistent behaviour between in RichTextBox.Select with SubString method
I am developing a Windows Form application. I use RichTextBox.LoadFile
method to load text from a file and highlight some portion of the text.
The text in the file contains return characters.
Suppose that I want to highlight the highlight. First I find the
startIndex and the length of the the highlight part, then use
RichTextBox.Select(startIndex, length) and give some color to it.
When I use SubString method, I can find the correct text. But when I apply
the same value of startIndex and length to Select method, the highlighted
part becomes [space][space][space]the highli. It looks the Select method
takes some return characters into account and cause some problem.
How can I resolve it?