Typing in combo box

rainesv

New member
Joined
Jan 21, 2003
Messages
2
Location
New Zealand
Hello

Im writing my first VB .NET app and have a combo box with style of DropDownLlist and for example values:

Chris
Craig
Ralph

If I type C in the dropdown list it goes to Chris, when I then press R it jumps to Ralph rather than going to Craig as it used to do in VB 6.

Is this by design? Is there a way to get round this?

Thanks
 
The combo in VB6 didnt work the way you describe either. What youre describing is an auto-complete feature thats not built into the standard windows combo. Ive seen people use the API to auto-select items as the user types, but I think the style being used was DropDownCombo not DropDownList. You would also have to check to make sure that partial entries dont "stick" in the text property because you normally want to force the user to pick something in the list, not allow "Cr" as a valid entry.

The standard combo with style DropDownList has you press the same letter repeatedly to select the next item. For your sample, you press "c" twice to highlight Craig.

There is probably a free ComboBox control written to use subclassing in .NET that does what you want. Try a search on Google for autocomplete ComboBox or something similar.

-nerseus
 
Originally posted by rainesv
Thanks just needed the right terminology for searching.

Found this code which works with a DropDown syle combo box.

http://www.codeproject.com/vb/net/autocomplete_combobox.asp

Added: cboRaisedBy.DroppedDown = True
to the the keydown event of my combo box and it works like a charm.
hey rainesv, i am currently trying to get the autocomplete combobox working. what is DB.tblNameRow used in the code?

Code:
Dim recName as DB.tblNameRow

-ashrobo
 
Back
Top