Hello Friends,
This code will helps us to use Cut, Copy, Paste and Undo functionality
I have use a rich text box here you can use normal text box as well
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
if (richTextBox1.SelectionLength > 0) richTextBox1.Copy();
}
// This will allow us to paste the text written in the text box.This will only work after you select the text in the Rich text box
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.Paste();
}
// This will allow us to cut the text written in the text box.This will only work after you select the text in the Rich text box
private void cutToolStripMenuItem_Click(object sender, EventArgs e)
{
if (richTextBox1.SelectedText != "") richTextBox1.Cut();
}
// This will allow us to undo the changes in the text box.
private void undoToolStripMenuItem_Click(object sender, EventArgs e)
{
if (richTextBox1.CanUndo == true) richTextBox1.Undo();
}