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

  • Thread starter Thread starter Grok
  • Start date Start date
G

Grok

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.SelectedItem = "Three"
selected the item "Three" in the Items.

but ListBox1.SelectedItem = "(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?
 
Grok,

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

Cor
 
Back
Top