Hi,
Thanks for this - although I have written a "generic" comparer (well it
compares 2 instances of the objects I want it to compare, on the keys I want
it to compare on). I'm using this in the ListView to sort, but the ListBox
is different. With the list view, all I need to do is set the comparer when
the user clicks on a column and it sorts automatically. Listbox's are more
primitive. I just have a ListBox.ObjectCollection, which doesn't support
sorting, so I have to do it myself somehow. Just thought there might be a
quick and easy way like with the ListView.
Cheers
"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:uq**************@TK2MSFTNGP12.phx.gbl...
Hi
I wrote a generic Comparer class for sorting collections of objects. Check
out the code:
http://weblogs.asp.net/jan/posts/6479.aspx
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Robin Tucker" <id*************************@reallyidont.com> schreef in
bericht news:bq*******************@news.demon.co.uk... How do I sort the items in a list box?
I am using a class derived from IComparer to sort items on columns in a
ListView, but the ListBox doesn't support this kind of facility. The
"items" in my list box aren't just strings, they are a class I have
defined for each list item. There is a comparitor function, but how can I
write - ListBox.Items.Sort() in this instance?
Do I need to do my own quicksort?