views:

312

answers:

2

Windows explorer in XP will allow you to make a file selection based on typing a few characters. I would like to know if there is any simplistic .net feature I can use to mimic this behaviour in a combobox? I think I've seen this happen in comboboxes before, and would like to know if there is a property I can use?

I know I could develop code around the "Key" events, but can't justify spending the time on it.

For example: In a folder which contains "Apple.doc, banana.doc, cherry.doc, cranberry.doc" then typing "b" will select "banana.doc", typing "c" will select "cherry.doc" but typing "cr" will select "cranberry.doc"

Thanks in advance G

+1  A: 

Have a look at ComboBox.AutoCompleteMode.

Daniel Brückner
Excellent. Thanks
G-
A: 

Thanks to Daniel for the above answer.

I would also like to point others with a similar queries to AutoCompleteMode which explains the details of each AutoCompleteMode value.

In summary:
None - Disables the automatic completion feature for the ComboBox and TextBox controls.
Suggest - Displays the auxiliary drop-down list associated with the edit control. This drop-down is populated with one or more suggested completion strings.
Append - Appends the remainder of the most likely candidate string to the existing characters, highlighting the appended characters.
SuggestAppend - Applies both Suggest and Append options.

G-