Hi BalamuruganThirumalaikumar-1818,
The Handled property is used to notify the base class whether the event has been handled or whether they need to resolve the event. It can only be used in the context of the Form.KeyPress event.
You need to use SuppressKeyPress in KeyDown event.
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode==Keys.Back || e.KeyCode==Keys.A)
{
e.SuppressKeyPress = true;
}
}
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.