Highlight specific string in Richtextbox control

This function highlight particular string by user defined color
call this function like in your code and put proper validation on your code.

richTextBox1.Text = "This is Sample Application";
for Ex. StartIndex=7,EndIndexLength=8,strCol =strCol and pass richtextbox1 control.

public string HighLightColor(int StartIndex,int EndIndexLength,Color strCol ,RichTextBox rbox)

rtbox.Select (StartIndex ,EndIndexLength);
return rtbox.Text;

This gives output "Sample" string is highlighted by Red color;


Author: ABitSmart22 Dec 2009 Member Level: Gold   Points : 0

Please format your resource.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: