please give me the solution to clear the contents of textBox using escape key.
Clear textBox value using escape Key
Sir, Please help me regarding Escape button and textBox.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Jay S159 reputationPosted May 14, 2013, 3:44 AM EDT
textbox1.text = string.empty
}
}
Terrance C25 reputationPosted May 14, 2013, 4:01 AM EDT
private void TextBox_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
textbox1.Clear();
}
else
{
e.handled = true;
}
}