I'm trying to sort the items in a listbox. So far, I have this Sub:
Code:
Sub SortListbox(ByRef box As ListBox)
Dim sortedItems As New SortedList
Dim i As Integer
For i = 1 To box.Items.Count - 1
sortedItems.Add(box.Items(i).Text, box.Items(i).Value)
Next
box.Items.Clear()
box.DataSource = sortedItems
box.DataTextField = "LinkText"
box.DataValueField = "id"
box.DataBind()
End Sub
This greets me with the friendly error:
"DataBinder.Eval: 'System.Collections.DictionaryEntry' does not contain a property with the name LinkText."
Am I on the right track? I think I'm really close.
-Colonel
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.