How to Suggest Values or Autocomplete Values When A User Types Into a Combo Box

08-06-2012

.Net has a 5 seconds super easy way to achieve this.

Use ComboBox.AutoCompleteSource and ComboBox.AutoCompleteMode properties:
(Available from .Net 2.0 onwards)

Steps:

  1. Load all possible values to ComboBox.Items collection – this is the easiest source available.
  2. Select Properties of the ComboBox and select ComboBox1.AutoCompleteSource to “List Items”
  3. Select ComboBox.AutoCompleteMode to anything other than “none”

 

Possible ComboBox.AutoCompleteMode values:

  • Suggest the combo box will show a list of matching items as you (or your user) types in the combo box. Then the user can select the appropriate item from the list.
  • Append the combo box will append the rest of the item that matches most to what you/user has/ve typed already. The user can select the suggestion by pressing the enter key or just continue typing.
  • SuggestAppend it will both append the rest of the most matching word as well as showing you the list of the rest of (closely) matching ones so you have more options.
  • None This will disable the Auto Complete Mode

 

Menol
ILT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: