[RESOLVED] - Close a form with [Esc] or Chr(27)
Hi, this is probably really easy but I am trying to close a form with the esc key.
This is the code I have but it isn't working.
Can anyone please help me with this.
Thanks in advance
JB
Hi, this is probably really easy but I am trying to close a form with the esc key.
This is the code I have but it isn't working.
VB.NET:
Private Sub frm_main_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = Chr(27) Then
me.close
End If
End Sub
Can anyone please help me with this.
Thanks in advance
JB
Last edited: