VS2003: Issue with Bound, Sorted ComboBox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pagates

    VS2003: Issue with Bound, Sorted ComboBox

    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

  • Frans Bouma [C# MVP]

    #2
    Re: VS2003: Issue with Bound, Sorted ComboBox

    pagates wrote:
    [color=blue]
    > 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.[/color]

    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

    --
    ------------------------------------------------------------------------
    Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
    My .NET blog: http://weblogs.asp.net/fbouma
    Microsoft MVP (C#)
    ------------------------------------------------------------------------

    Comment

    Working...