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:
- Load all possible values to ComboBox.Items collection – this is the easiest source available.
- Select Properties of the ComboBox and select ComboBox1.AutoCompleteSource to “List Items”
- 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