Windows Forms: How to copy paste plain text in RichTextBox in C#

This post shows you How to copy paste plain text into a RichTextBox in C# Windows Forms Application.

Dragging a RichTextBox control from your Visual Studio toolbox to your form designer.

c# copy paste in richtextbox

By default, Instead of pasting the text with format. We can extract the plain text, then add it into the RichTextBox control.

Clicking on RichTextBox control, then select properties.

Adding a KeyDown event handler allows you to paste text into a RichTextBox control.

private void richTextBox_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Control && e.KeyCode == Keys.V)
    {
        richTextBox.Text += (string)Clipboard.GetData("Text");
        e.Handled = true;
    }
}

Every time you copy data, it will be stored in the Clipboard. To get plain text to can call GetData("Text") method.