K Ken Tucker [MVP] Feb 11, 2004 #2 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
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
A Armin Zingler Feb 11, 2004 #3 John said: How can I capture Esc key on my form? Click to expand... Have a look at the Form's CancelButton property. Usually used with modal Forms. -- Armin How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
John said: How can I capture Esc key on my form? Click to expand... Have a look at the Form's CancelButton property. Usually used with modal Forms. -- Armin How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html