How to Chang Color of particular text in huge data

csharp , txt col Karāchi, Pakistan
  • 11 years 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
  • 11 years ago
    Try changing the color property in the element's properties window ;)
  • 11 years 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).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold