I have a rich text box and I’ve implemented a search option for it. When the user searches a string, all the matches gets highlighted with yellow background. I want that when the user presses the search button again, all of the previous highlights will be removed before the new search begins.
I found out two ways to do it:
1. select all text and then choose the back color to be the default one.
2. remove all text from the text box and then put it back again.
Both ways work, but it doesn’t look natural when I use them.
So, is there another way that I can remove all highlights from the text?
I’m using .NET framework 4 and I write in C#.
here is the idea written in semi C# psedocode hope it helps
EDIT:
trying this:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=146
Edit2:
works awesome!