troubleshooting Question

Trapping the ESC Key on a form in VB.NET

Avatar of swtiley
swtiley asked on
Visual Basic.NET
3 Comments2 Solutions1252 ViewsLast Modified:
Hi I am working on a VB.NET application.

My main form, has a number of controls on it, and at run-time creates an additional number of buttons. I want to be able to trap when the ESC key is being pressed, whatever the current focus on the form is.

I have tried mybase.keydown and a number of other options, all to no avail.

Therefore my question is, how do I trap for the ESC key, whatever the focus on the current form ?

Many thanks in advance


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros