Hi,

I have a RichTextBox where I expect 100 characters per line. Each line can start with the letter A, B, or C. I may have thousands of lines and most of them will start with the letter C.

When the cursor is moved from one line to another and is placed on a "C" line, I need to be able to quickly locate the nearest "B" line above it. It may be hundreds of lines away. A loop to search for the "B" line using GetFirstCharIndexFromLine(x) is too slow.

The user may want to paste many lines into the textbox. If necessary, a mild wait after pasting is acceptable.

Do you have any suggestions for a technique to accomplish what I need to do? Even just a high level suggestion like "use a linked list" would be appreciated.

Thanks.