Select correct item in the combobox with the same items

J

janezcas

Hi,

I have noticed the following problem with the combobox:

1. Put combobox on the form.
2. Add couple of items, two of them should be the same. For example,
add the following items:
- Sam
- John
- Peter
- John
- Michael

3. Now run the project and select the second John with the dropdown
(fourth item in the combobox). John is now selected in the combobox.
4. Now open the dropdown again. The first John is selected (second
item in the combobox). It seems that it is impossible to select
anything but the first item among the multiple same items. If
DropDownStyle is set to DropDownList, it works OK.

Any workaround?

I am using .NET Framework 2.0.
 
A

Armin Zingler

Hi,

I have noticed the following problem with the combobox:

1. Put combobox on the form.
2. Add couple of items, two of them should be the same. For example,
add the following items:
- Sam
- John
- Peter
- John
- Michael

3. Now run the project and select the second John with the dropdown
(fourth item in the combobox). John is now selected in the combobox.
4. Now open the dropdown again. The first John is selected (second
item in the combobox). It seems that it is impossible to select
anything but the first item among the multiple same items. If
DropDownStyle is set to DropDownList, it works OK.

Any workaround?

I am using .NET Framework 2.0.

Change DropDownStyle = DrowDownList?

If it's not DrowDownList, you can also enter "John". That means, it's only
the Text that matters, not the index. Therefore, after reopening the drop
down list, the first match can be selected because it's the same text. The
drop down list is only there to select some predefined texts. In short, you
can not rely on the index anyway because you can enter text manually that is
not in the list.


Armin
 

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