Im coding in vb6 and for fun thought I would play around with the keypress event to make things move. I came to the quick realization that a VERY limited number of keys would respond to key press events. i wanted to use the arrow keys but it seems although there are reserved commands for them (VBKeyUp
,VBKeyDown
,VBKeyRight
,VBKeyLeft
) they just dont do anything. is there an explanation for this or do they just have no support? Code im using is below.
Private Sub ListView67_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyUp Then
Command1_Click
End If
If KeyAscii = vbKeyDown Then
Command4_Click
End If
If KeyAscii = vbKeyRight Then
Command2_Click
End If
If KeyAscii = vbKeyLeft Then
Command3_Click
End If
End Sub
Use KeyDown event instead of KeyPress
Private Sub ListView67_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp Then
Command1_Click
End If
If KeyCode = vbKeyDown Then
Command4_Click
End If
If KeyCode = vbKeyRight Then
Command2_Click
End If
If KeyCode = vbKeyLeft Then
Command3_Click
End If
End Sub