Groups | Blog | Home
all groups > vb.net controls > december 2005 >

vb.net controls : ListBox.SelectedValue incorrect if .Sorted = true.


Rob R. Ainscough
12/19/2005 2:51:52 PM
Is this a bug in .NET framework 2.0??

I have a ListBox bound to a DataTable with a DisplayMember and ValueMember
set -- if the ListBox property "Sorted" = True it will only sort the
DisplayMember leaving the ValueMembers unsorted and a mixed up jumble.

Can't believe something this obvious made it thru such a long testing
process.

Please don't tell me this is "this is intended behavior"!

Claudiu
12/23/2005 10:26:29 AM
This is a bug in programming, because Sort is ment to sort all item from
ListBox, you should do

Dim dataView as new DataView(myTable)
dataView.Sorted="sortedField"
lstBox.DataSource=dataView
lstBox.DataMember = "dataMember"
lstBox.ValueMember = "valueMember"

On Tue, 20 Dec 2005 00:51:52 +0200, Rob R. Ainscough <robains@pacbell.net>
[quoted text, click to view]



--
AddThis Social Bookmark Button