Click here to Skip to main content
15,882,152 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How do you sort integer inside a listbox in desceding order?


1 solution

Don't sort anything in controls like this. Have your data in some suitable collection and sort your data first like in System.Collections.Generic.List<int>.Sort(), using, say (or keep it always sorted like in System.Collections.Generic.SortedList, System.Collections.Generic.SortedDictionary) and then populate the control with data or bind it.

As you need to use custom order in sorting, use this:[^],[^].

Code samples are available in the help MSDN articles referenced above.

Share this answer
fjdiewornncalwe 8-Dec-11 14:13pm    
+5. I was thinking the same thing.
Sergey Alexandrovich Kryukov 8-Dec-11 14:21pm    
Sure, we "fools think alike"... :-)
Sergey Alexandrovich Kryukov 8-Dec-11 14:22pm    
Thank you, Marcus. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900