Saturday, 24 August 2013

Delete Selected Text in Richtextbox

Delete Selected Text in Richtextbox

I have a richtextbox and i want to delete not cut the selected when the
user presses a button.
I have used
private void button1_Click(object sender, EventArgs e)
{
SendKeys.Send("DELETE");
}
This works but i want to know another way to do it.
I have tried
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.SelectedText.Replace(richTextBox1.SelectedText, "");
}
This doesn't perform any action.
Pls what can i do?

No comments:

Post a Comment