Steve Putt
August 8th, 2002, 02:51 PM
Another rookie question...
I want to use the arrow keys to execute some code in my form. I've been all through "Help", which is no help at all. I've found KeyPress (says it doesn't work with arrows) and KeyDown, but I can't figure out what arguments to use, and I also can't find the key codes in Object Browser.
For a "Private Sub Form_KeyDown(keycode As Integer, shift As Integer)", what form is the keycode? Do I just use the 37, 38, 39, and 40 integer values for the arrow keys?
My form is filled with 150 picture boxes (created at runtime). I want the keydown to work regardless of the focus. Help says "If the KeyPreview property is set to True, a form receives these events before controls.... Use the KeyPreview property to create global keyboard-handling routines." Can I put a KeyPreview in the frmMain_Load sub (my form is named frmMain), and what will it look like?
I want to use the arrow keys to execute some code in my form. I've been all through "Help", which is no help at all. I've found KeyPress (says it doesn't work with arrows) and KeyDown, but I can't figure out what arguments to use, and I also can't find the key codes in Object Browser.
For a "Private Sub Form_KeyDown(keycode As Integer, shift As Integer)", what form is the keycode? Do I just use the 37, 38, 39, and 40 integer values for the arrow keys?
My form is filled with 150 picture boxes (created at runtime). I want the keydown to work regardless of the focus. Help says "If the KeyPreview property is set to True, a form receives these events before controls.... Use the KeyPreview property to create global keyboard-handling routines." Can I put a KeyPreview in the frmMain_Load sub (my form is named frmMain), and what will it look like?