Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

RichTextBox - How do I unselect selected text?

$
0
0

I have a RichTextBox.  Various strings in the RTB are highlighted depending on user interaction with another control.  The general, highlevel, logic to highlight a string is ... unselect whatever might currently be selected, select the new string. My problem is that nothing I have tried will do an unselect, i.e. turn off the highlighting so that it appears just like the other text.

To do the highlighting I am using rtb.Select(start,length) and then set SelectionColor to red.   I've tried things which appear to have worked for others but they ain't working for me.  I've tried rtb.Select(0,0), I've tried rtb.SelectAll and then setting the SelectionColor to black.  I've tried setting the SelectionStart and SelectionLength properties to 0.  Nothing has worked.  

If it might matter this is .Net 3.5.

Thanks,  Bob

 


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>