With a ComboBox there are multiple properties and events that interact.


Now I have a static collection of Objects, that contain String Values as their names. I add those names in alphabetical order (and by way of the list creation numerical indicies as well) to the combobox.

DropDownStyle = DropDownList
In this mode, you cannot "edit" the text of the control, but you can type the 1st character in order to jump through the list. However, it doesn't allow you to type multiple characters to find the 5th item beginning with the letter "B"

If I type "B" then "T" it will first jump to BHTY in the list, and then to the TREE item in the list. This is not what I want.

DropDownStyle = DropDown
AutoCompleteMode = Append
AutoCompleteSource = ListItems
THis allows you to type into the text box control, and as what you type matches items currently contained within the list it will implicitly suggest the item closest matching the item you want.
If I type "B" then "T" the text property will reflect "btRE" the "re" being still selected. Once I exit the control (or press <enter>) the event
SelectedIndexChanged() is fired. I want the Index to reflect exactly what is in the Text property as I Type. Thus I Type:
"B" -> BHTY is Selected, and the SelectedIndex = the Index of BHTY in the List Items.
"O" -> BOLL is selected, and the SelectedIndex = the index of BOLL in the List Items.
"R" -> BORI is selected, and the SelectedIndex = the index of BORI in the List Items.

Is there a way to effect this behavior in the default ComboBox with property settings or event handler, or do i have to write my own KeyDown() events in order to jump to the appropriate Item?

Jaeden "Sifo Dyas" al'Raec Ruiner

Recommended Answers

All 5 Replies

The Following code will help you as you have specified in the requirement.

The the code order is changed it will not work properly

so following the order as specified

ComboBox1.AutoCompleteMode = AutoCompleteMode.Append
ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
ComboBox1.AutoCompleteSource = AutoCompleteSource.ListItems

Hi Jaeden

have you found a solution for this?

We appreciate your willingness to contribute but please check the dates on posts before you respond to them This thread is more than three years old and it is likely that the original poster (OP) no longer needs help with this issue. Reviving this thread pushes more recent threads further down the list. If you continue to revive old threads you may be hit with an infraction.

Oh! I'm so sorry I didn't notice the date, I thought that since this thread is not solved, I posted my link so that anyone, if anyone may find this thread he/she can see what the answers...maybe i'll post new thread for all of my topic..

I am also a newbie...

I am also a newbie

No problem. I did the same thing when I was a noob. That's why you got the boilerplate. Unfortunately it is a fact that a lot of people who ask questions never bother to mark their threads as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.