Valhalla Legends Forums Archive | Visual Basic Programming | Question....

AuthorMessageTime
OuTLawZGoSu
Sup.. How can i add a shortcut key. EX: i need for a form to close wen i press Esc. can someone give me that code?

Thx

L8terZ
August 9, 2003, 4:38 PM
drivehappy
This works if focus is set to the Form:
[code]
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape then
Unload Me
' If you want it to end the program use this in conjunction with Unload Me: End
End If
End Sub[/code]
August 9, 2003, 4:57 PM

Search