Windows Develop Bookmark and Share   
 index > Windows Forms General > How-To: Incremental Search ComboBox
 

How-To: Incremental Search ComboBox

I have a combo-box on a form that lists user names. This list is populated and the control has focus. When the users presses a letter on the keyboard, it control will move to the first item that starts with that letter. But it will only search on the first letter and not all letters as the user types. Is there a way to enable that in VB.NET winforms in VS2005? This seems like a pretty basic feature that has been around before, I'm sure I'm just missing how to enable it.

Thanks

Kirk
Kirk_Kelly  Wednesday, December 27, 2006 5:21 PM
I think you're talking about the way a combobox behaved in Microsoft Access. To get what you want, you'd have to change the DropDownStyle property from DropDownList to DropDown. That has the nasty side-effect that you can have text in the textbox that doesn't match a dropdown list entry. Nevertheless, you can now implement the KeyPress event and autocomplete the user's entry. Use SelectionStart/Length to let her overtype the matched characters. Careful with backspace.

In DropDownList style, you get it to select the next entry by typing the start letter again.
nobugz  Wednesday, December 27, 2006 8:08 PM

Hi,

try setting your combobox's AutoCompleteMode to SuggestAppend and AutoCompleteMode to ListItems. Leave DropDownStyle set to DropDown.

SetAutoCompleteMode to Append only, if you don't want the list to dropdown when typing...

Andrej

Andrej Tozon  Thursday, December 28, 2006 8:43 AM
I think you're talking about the way a combobox behaved in Microsoft Access. To get what you want, you'd have to change the DropDownStyle property from DropDownList to DropDown. That has the nasty side-effect that you can have text in the textbox that doesn't match a dropdown list entry. Nevertheless, you can now implement the KeyPress event and autocomplete the user's entry. Use SelectionStart/Length to let her overtype the matched characters. Careful with backspace.

In DropDownList style, you get it to select the next entry by typing the start letter again.
nobugz  Wednesday, December 27, 2006 8:08 PM

Hi,

try setting your combobox's AutoCompleteMode to SuggestAppend and AutoCompleteMode to ListItems. Leave DropDownStyle set to DropDown.

SetAutoCompleteMode to Append only, if you don't want the list to dropdown when typing...

Andrej

Andrej Tozon  Thursday, December 28, 2006 8:43 AM

You can use google to search for other answers

Custom Search

More Threads

• Installing .net on win ME or win 98
• .exe file keeps looping
• How to disable the non-exposed right-click event of a 3rd party control
• Obtaining information of object being dragged...
• Masked Edit in TextBox
• appupdater weird problem
• ContextMenuStrip check boxes to work like RadioButtons?
• RichTextBox question
• Detecting a Memory Leak
• Document Management System in .NET (Version Control)