Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a program which displays a RichTextBox.
I do not want the user to copy the content of the RichTextBox so I need to freeze the Ctrl+C and Ctrl+V. How can I do that?
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace test1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            pp();
        }
        private void pp()
        {
            string str = "DearSir,\nIn regard to your inqurey about....\nthanks";
            richTextBox1.Text=str;
        }
    }
}
Posted
Updated 11-Feb-11 2:30am
v3

A quick Google search on "C# disabling copy paste" will answer that[^].

Note: There are many ways to copy/paste. Ctrl+C/Ctrl+V, Ctrl+X to cut, Ctrl+Insert/Shift+Insert, and the Menu key to bring up the context menu (which usually has copy/paste submenus).
 
Share this answer
 
v3
Comments
Nish Nishant 11-Feb-11 7:57am    
Voted 5. Proposed as answer!
thatraja 11-Feb-11 12:04pm    
Sensible answer BAB, 5!
Sergey Alexandrovich Kryukov 11-Feb-11 14:02pm    
This is correct, my 5.
In some cases you need it (unfortunately, I had to do this trick); but the fact this is needed is sad. I wish civilized method exist, but to have it we would need better component than RichTextBox (and not that ill RTF format).
--SA
this[^] may help you to sort out your problem.
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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