Listbox Selected Value problem

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
 
M

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
 

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