hey all, i wan't ask..
how make shortcut in form..,
did i've to use keyup or keydown event ..???

i need some reference pliss...

Recommended Answers

All 7 Replies

I don't get what you want to exactly.
Please more specify.

i have one form, when i press esc in my keyboard form will close...
how do that with code...???

See if this helps :

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then
    Unload Me
End If
End Sub
commented: helper +3

From memory, I think you also need to set the keypreview property on the form otherwise the keypress will be sent to the control that has focus

it's help me...

and i was have code for that too, this my code :

Private Sub TxtID_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbkeyF1 Then
Form2.Show 1
End if
End sub

This Thread Solve, thanks...

Good. :D
Don't Forget to mark this thread as Solved.

if keyascii=1 then
unload me
end sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.