Capellan
Jun 20 2008, 07:29 AM
Hi all,
I have a combobox on my form that I'd like to use the KeyDown event with in order to scroll forward and backward through the items in the list with the up and down arrow keys. It works fine when the combobox is by itself on a form, but if there are other controls, it will move to those after the event has finished. Is there any way to override it from moving to the next control?
As an alternative method I could just use the .dropdown command OnEnter to be able to use the up and down keys, but since I figured that out after I started doing what I was working on, I thought I'd ask anyway.
fkegley
Jun 20 2008, 10:54 AM
I think this will do what you want. Place a transparent command button on the form. Move it in the tab order so it is right after the combo box. In its GotFocus event, put this code:
Me.NameOfComboBox.SetFocus
'you can even drop down the list
Me.NameOfComboBox.DropDown
Capellan
Jun 23 2008, 08:19 AM
That works fine for going down the list, but when I added a second for going up, sometimes the focus wouldn't go to the combobox, even though all other controls were set to not have a tab stop except for the transparent buttons. It was strange, even without the transparent button there, it would sometimes stay in the combobox and only sometimes go to the previous tab stop.
Thanks for the idea.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.