Idiosyncrocy in Microsoft combobox. Need workaround

G

Guest

I think there is a behavior bug in the combobox control. If you create a new
form and add a combobox to it with the following code line to add items to it:

Me.ComboBox1.Items.AddRange(New Object() {"Apple Sauce", "Banana",
"Apple", "Peach", "Plum"})

The behavior is normal except when you choose Apple. When Apple is
selected, if you click the down arrow, Apple Sauce is highlighted (Not
apple). This behavior is causing me a problem. Is there a work around? As
you might expect, this problem is most annoying if Apple is actually item 20
and the end user is using the dropdown feature to move to the next item. All
of a sudden, he is back at item 2 instead of 21.
 
H

Herfried K. Wagner [MVP]

genojoe said:
I think there is a behavior bug in the combobox control. If you create a
new
form and add a combobox to it with the following code line to add items to
it:

Me.ComboBox1.Items.AddRange(New Object() {"Apple Sauce", "Banana",
"Apple", "Peach", "Plum"})

The behavior is normal except when you choose Apple. When Apple is
selected, if you click the down arrow, Apple Sauce is highlighted

It seems that the first item matching the pattern "Apple*" is selected. You
may want to set 'DropDownStyle' to 'DropDownList'. This should fix the
probem.
 
G

Guest

All properties are default. (Sorted is False). If sorted was true, there
would not be a problem because Apple would preceed Apple Sauce. In my
example, Apple is later in the list. Hopefully, you can confirm the behavior
that I am experiencing. I am using .NET 1.1.
 
G

Guest

Thank you very much. Problem Solved.

Herfried K. Wagner said:
It seems that the first item matching the pattern "Apple*" is selected. You
may want to set 'DropDownStyle' to 'DropDownList'. This should fix the
probem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top