Capturing key

  • Thread starter Thread starter John
  • Start date Start date
Hi,


Set the form keypreview to true if you want to catch esc no matter
what control has the focus.

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Escape Then

MessageBox.Show("Escape")

End If

End Sub



Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top