Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I disable a ESC Key On a C# Language

Status
Not open for further replies.

rr3news

Programmer
Apr 15, 2003
15
0
0
BR
Hi,
I need your about:
1 - How can I disable a ESC key on C# (Winform) ?

Thanks
 
On your form (assuming you are using a form) turn KeyPreview = true;

Then capture the OnKeyDown event and add this code:

private void Form1_OnKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Esc)
{
e.Handled = true;
}
}

done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top