Typing in combo box

rainesv

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

I'm 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 didn't work the way you describe either. What you're describing is an auto-complete feature that's not built into the standard windows combo. I've 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 don't "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
 
rainesv said:
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?

Visual Basic:
Dim recName as DB.tblNameRow

-ashrobo
 
Back
Top