How to prevent selection of text in a text control (e.g. textbox or richtextbox

Hi all!
I have a richtextbox control which I want to make available to users.
They can read its contents but I don't want them to be able to select any text or copy them

What I have done
1. I set the property of the control to read only
2. I wrote this

 if(rtfCase.SelectedText.Length > 0)rtfCase.SelectedText = "";

in the MouseUp, KeyUp and SelectionChanged events of the RTF control, but no luck.
Can someone please help me out.

Thank you
Who is Participating?
rubixxcubeConnect With a Mentor Commented:
I would simply set the Enabled property of the control to false.
If you don't want to do that then you could use the selectionChanged event as follows:
private void rtf_SelectionChanged(object sender, System.EventArgs e)
innovator2Author Commented:
Thanks. It works fine.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.