Is there anyway in VB that if you have a combobox for "Hair color"
that if you type the 1st letter, the combobox will automatically scroll down and select the hair color?
For example, here's the list of hair colors:
Green
Orange
Yellow
Gray
Black
Blue
If I push the button "B" on the keyboard, I would like the blank combo box to select "Black" first. Kind of a shortcut for lazy users that don't want to click on the combobox to make their selection.
That will take will find a match to whatever key you press if there is a match. And it will use the first one found if there are more than one. You might have to change I to be 0 to Listcount - 1.. can't remember the lbound of a combobox offhand.
It also only works when the text is empty that way if the user is typing something else in the box it wont erase it and put the color in there.
That works perfectly, I had to change the I to I = 0....... however, 1 minor thing, do you know how to include either uppercase or lowercase when you do a keypress?
For now all the colors have a capital letter as the first letter, typing a lower case letter into the combobox doesn't do anything........
One more thing I forgot about, is there anyway that if you type a letter, the combobox opens up and the highlighter goes down to the one you selected?
Plus: When I type "B" for example, if there's more than 1 "B" in the list of colors, if I push the "down" arrow key, the highlighter goes straight to the first one on the list..... is there a way for the highlighter to continue down the combobox list?
Originally posted by Trancedified One more thing I forgot about, is there anyway that if you type a letter, the combobox opens up and the highlighter goes down to the one you selected?
Plus: When I type "B" for example, if there's more than 1 "B" in the list of colors, if I push the "down" arrow key, the highlighter goes straight to the first one on the list..... is there a way for the highlighter to continue down the combobox list?
but I bet that he set the Combobox Style to: 2 - DropdownList
Wich it autmatically does what you want...it even does it better that "reinventing sweetened water"
as you type...the Combobox is updated....
you can have two or more words that start with the same letteres...ans as you type the complete word it will be selected...
ex.
(set the Sort property of the Combobox to True)
list:
cry
carriage
cartoon
if you type "c" it'll be poiting to cry
if you type "ca" it'll point carriage
if you type "car" it'll still be pointing to carriage
but...
if you type "cart" then it'll be pointing to cartoon
and if you press backspace...it'll be returning to the previous selection...according to the letters typed.
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at:
Sure, the combobox when style = 2 and sorted = true does what you describe, but the code I posted (which was written by Aaron Young) does more. It allows you to press the backspace key to "take back" the last letter you typed, it allows you to set the time limit before a new search begins and it allows you to decide if you want to hear a beep when no entry matches the typed letter(s).