Listbox Selected Value problem

  • Thread starter Thread starter mick
  • Start date Start date
M

mick

I have a databound listbox with the Display Member set to the 'Name' field
of my table and the Value Member set to the 'ID' (int) field. Now when I
select
a listbox item I can get the 'ID' of that item with listbox.SelectedValue as
expected.
The problem is, if I set the listbox Sort property to true then
listbox.SelectedValue no
longer returns the correct value for a particular selected item. Anyone know
why this
is the case?

TIA

mick
 
Peter Duniho said:
The docs do specifically say not to use the Sort() method with data
binding. You are supposed to sort the data source itself instead.

Thanks for that. I`m new to this so I wasnt aware you werent supposed to
use the Sort() . I just couldnt see what I was doing wrong:-).

mick
 
Back
Top