ListBox.SelectedItem = "whatever" fails with data-bound?

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

    ListBox.SelectedItem = "whatever" fails with data-bound?

    Is this a feature of ListBox that when using a DataSource, the
    SelectedItem acts different?

    Added ListBox1 and ListBox2 to a form.
    ListBox1 is bound to a DataSource where DisplayedMember =name and
    ValueMember=id from the table.
    ListBox2 filled by AddRange(New String() {"One", "Two", "Three",
    "Four", "Five"})

    ListBox2.Select edItem = "Three"
    selected the item "Three" in the Items.

    but ListBox1.Select edItem = "(name of any item in the list)"
    does not cause any item to be selected.

    How does one use .SelectedItem = "value" with data-bound list
    controls?
  • Cor Ligthert[MVP]

    #2
    Re: ListBox.Selecte dItem = "whatever& quot; fails with data-bound?

    Grok,

    That depends on your datasource, however it has at least to implement in
    whatever way the Ilist's

    Cor

    Comment

    Working...