Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I display a dropdownlist in descending order 1

Status
Not open for further replies.

tango1948

Programmer
Dec 23, 2006
111
IL
Hi
I have a dropdownlist that's bound to a sortedlist, I would like to sort the keys in descending order, strangely I can't find a sortedlist method that will do this.
Is it possible to get the sortedlist or the dropdownlist in descending order without using a Select Order By statement? Any help and code snippets appreciated.

Thanks

David
 
Found this for a listbox, seems to work fine when called:

Sub listdescend(ByRef box As listbox)
'sorts listbox descending
Dim array1 As New ArrayList()
Dim loop1 As Integer
For loop1 = 0 To box.Items.Count - 1
array1.Add(box.Items(loop1).Text)
Next
array1.Sort()
box.Items.Clear()
For loop1 = array1.Count - 1 to 0 step -1
box.Items.Add(array1(loop1))
Next
End Sub
 
hi arznrchrd,
Thanks for your reply. In the end I changed sortedlist to dictionary and that solved my problem.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top