Check to see if a key is being held down

D

Dale Fye

Is there any easy way to test to see whether a key is being held down?

I've got a form that contains a text box (txt_Find) and a listbox. Right
now, when the user types in txt_Find, I'm using the Change event to locate
the first record in the listbox where a value is greater than the text in
txt_find.

I've also implemented some code in the keyUp event to check to see whether
the key being pressed is the up or down arrow, and if so, to select the row
above or below the one that is currently highlighted. This works fine, but
because it is in the KeyUp event, I have to keep pressing the up or down
arrow key. I would like to be able to just hold either of these keys down,
and have the application scroll up or down through the list while maintaining
the focus in txt_Find.
 
D

Dirk Goldgar

Dale Fye said:
Is there any easy way to test to see whether a key is being held down?

I've got a form that contains a text box (txt_Find) and a listbox. Right
now, when the user types in txt_Find, I'm using the Change event to locate
the first record in the listbox where a value is greater than the text in
txt_find.

I've also implemented some code in the keyUp event to check to see whether
the key being pressed is the up or down arrow, and if so, to select the
row
above or below the one that is currently highlighted. This works fine,
but
because it is in the KeyUp event, I have to keep pressing the up or down
arrow key. I would like to be able to just hold either of these keys
down,
and have the application scroll up or down through the list while
maintaining
the focus in txt_Find.

If you use the KeyDown event, it will fire repeatedly while the key is held
down. At least, it does in A2K3.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top