Community discussion forum

How to Chang Color of particular text in huge data

  • 8 months ago
    Dear All, I am want to change color of text or string through code in c #, I have a rich text box in which i fill data by for loop and i find that word which i want to change like word is Software and now i want to change its color like red and display in same rich text box code which i am using, string[] strval; strval = dr["bReceivedData"].ToString().Split(' '); for (int i = 0; i < strval.Length; i++) { if (strval[i] == "Software") { abc = abc + strval[i]; txtcolor.Text = strval[i]; } else { abc = abc + strval[i]; } I get name successful now tell me please how can i change color of word and which technique is better for this, I thing dot net provides brush or some thing like that. Kindly do replay. Thanks
    Post was edited on 17/03/2009 04:47:43 Report abuse
  • 8 months ago
    Try changing the color property in the element's properties window ;)
  • 8 months ago
    Read following topic [Formatting Text in a RichTextBox by Parsing the Rich Text Format (RTF)](http://www.codeproject.com/KB/cs/RTFSyntaxColour.aspx)

Post a reply

Enter your message below

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback