How to make a RichTextBox un-editable?

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

I need to have a RichTextBox that displays various text (in color), but
the user cannot highlight or edit the text in anyway, With a regular
textbox, I can set .Enabled=False and that does exactly what I want, but
with the RichTextBox, setting .Enabled=False turns the box grey, and I
need it to stay on the BackGround color....labels won't do, as I need
individual words to be different colors.

Any Ideas?

Scott
 
Scott said:
I need to have a RichTextBox that displays various text (in color),
but the user cannot highlight or edit the text in anyway, With a
regular textbox, I can set .Enabled=False and that does exactly what
I want, but with the RichTextBox, setting .Enabled=False turns the
box grey, and I need it to stay on the BackGround color....labels
won't do, as I need individual words to be different colors.

Any Ideas?

Does setting .readonly = true help?
 
No, I thought it would too. Not sure what that property does, as I sure
can write to it at runtime!

you can always write to it using code (the idea is that the user can't alter
the text directly) try setting readonly of the rtb to true in the designer
it works here.

eric
 
you can always write to it using code (the idea is that the user can't
alter
the text directly) try setting readonly of the rtb to true in the
designer
it works here.

eric

Yes, it does almost what I'm after, but the user can still select parts of
the text (hightligting it)

Scott
 
Scott Hather said:
Yes, it does almost what I'm after, but the user can still select
parts of the text (hightligting it)

Right, but he can not change it. Why take him the possibility to copy the
text to the clipboard? I often switched to readonly textboxes instead of
labels because of this possibility.
 
Back
Top