Click to See Complete Forum and Search --> : KeyPreview and UserControl


Crazy D @ Work
June 3rd, 1999, 05:20 AM
Hi
I'm having a slighly problem with the keypreview of a form when using a custom control with a textbox on it.
When I set the keypreview to true, it works pretty fine, except for the cursorkeys (vbKeyUp and vbKeyDown to be exact). And those are the ones I want to have in the form_keypress...
It seems that these keys aren't passed to the form. But, with a regular textbox, things work fine... In the keydown/press of the usercontrol, it works fine... but I don't want to check in all keydown/press events to see if the cursorkey was pressed (why else do we have the keypreview...)
Has anyone figured a workaround for this?
Tnx in advance

Crazy D :-)

Jewe
December 11th, 2003, 06:48 AM
Hi,

I had the same problem..
my solution was inserting a event KeyDown(KeyCode As Integer, Shift As Integer).
in every control event I called the function :
ReactToKeyDown(KeyCode As Integer, Shift As Integer)

this solved my problem..

hope it helps,

Jewe