Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: OuTLawZGoSu on August 09, 2003, 11:38 AM

Title: Question....
Post by: OuTLawZGoSu on August 09, 2003, 11:38 AM
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
Title: Re:Question....
Post by: drivehappy on August 09, 2003, 11:57 AM
This works if focus is set to the Form:

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