I have a databound form, one of the fields is a note field and I have it displayed in a RichTextBox. I want to be able to highlight certain words in the textbox.
If I use something like:
RTB.Select(5, 5)
RTB.selectionBackColor = Color.Yellow
everything works as expected, the 6th - llth characters are highlighted, when I move to the next record nothing is highlighted as expected.
The strange problem I have come across is if I use a start index of 0
RTB.Select(0, 5)
RTB.selectionBackColor = Color.Yellow
When I do this the first 5 characters are highlighted as expected but if I move to the next record or any other record from that point forward all the text is highlighted. The highlighting only goes away if I move to a blank note field.
Has anyone else come across this problem before? Any suggestions?
I have tried all methods of selecting the text and I get the same result, I even just created a new form with no other code and just the Rtb note field and I get the same result.
Thanks
If I use something like:
RTB.Select(5, 5)
RTB.selectionBackColor = Color.Yellow
everything works as expected, the 6th - llth characters are highlighted, when I move to the next record nothing is highlighted as expected.
The strange problem I have come across is if I use a start index of 0
RTB.Select(0, 5)
RTB.selectionBackColor = Color.Yellow
When I do this the first 5 characters are highlighted as expected but if I move to the next record or any other record from that point forward all the text is highlighted. The highlighting only goes away if I move to a blank note field.
Has anyone else come across this problem before? Any suggestions?
I have tried all methods of selecting the text and I get the same result, I even just created a new form with no other code and just the Rtb note field and I get the same result.
Thanks