VS2003: Issue with Bound, Sorted ComboBox

G

Guest

Hello All,

I seem to have found a problem using a ComboBox. If you bind a ComboBox to
an ArrayList of classes, setting the DisplayMember to one field in the class
and the ValueMember to another, and the ComboBox is sorted, then the bounded
indices are incorrect.

It appears that the ComboBox is sorted on ValueMember, but the associated
DisplayMember does not come along for the ride.

pagates
 
F

Frans Bouma [C# MVP]

pagates said:
Hello All,

I seem to have found a problem using a ComboBox. If you bind a
ComboBox to an ArrayList of classes, setting the DisplayMember to one
field in the class and the ValueMember to another, and the ComboBox
is sorted, then the bounded indices are incorrect.

It appears that the ComboBox is sorted on ValueMember, but the
associated DisplayMember does not come along for the ride.

Correct, I ran into this issue some time ago as well. I sorted the
arraylist with its Sort() method first, then bound it to the combobox
and not set the combobox as sorted.

FB

--
 

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