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

Posted on 2005-05-13
Last Modified: 2011-04-01
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
Question by:innovator2
    LVL 2

    Accepted Solution

    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)

    Author Comment

    Thanks. It works fine.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now