Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • 4 months later...
Posted
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?

 

Dim recName as DB.tblNameRow

 

-ashrobo

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...