Click here to Skip to main content
15,902,886 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I hv a richTextBox in Windows Appliction form (C#).
it has some text say:123456789 of black forecolor.
On some event, I make the part of text (say:123) to Red Forecolor and on other event I make it Undo. (Now,again all are black)

Now the problem is that, when I select 12345, it doesnt recognise the selected color(IsknownColor=false). but if I select the text seperately (say: 123 and 45) . It gives IsknownColor=True

Instead of checking on: SelectedColor.
I hv use following:

if (RichTextBox1.SelectedRtf.Contains("red255"))
        MessageBox.Show("Please do not select the already selected text!!");
Share this answer
refer from
Rich Text Formatting

in link
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900