(Q) How do I disable the Page Up/Page Down and other keys in my form?
(A) Set the Form's Key Preview property to True and put the following
code behind the OnKeyDown event. (The code disables the Alt and Tab keys as well.) Note
that the Case Else statement, if uncommented, will print out the codes of any other keys
you want to disable.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 33, 34, 9, 18
KeyCode = 0
Case Else
End Select
End Sub
|