[Closed] Sorting ListView
I’m currently working in ActiveX to get comfortable before i move on to .Net, I see that you are able to sort by the main List Item, but was wondering if its possible to sort by the SubList Item as well. Most of the tutorials i’ve looked at have been fairly vague on the subject.
Does anyone know if this is possible, and if yes, point me in the right direction?
Thanks for your time.
whats up Hobbs,
I’m not sure if there is a better way, but I’ve used qsort in the past. Usually I’ll build a 2 dimensional array holding arrays that store the item index and the subitem I want to sort by. My qsort function will sort according to the second element of each array (the subitem name), then I’ll repopulate my list according to the new order that the indices are in (the first element in the arrays). Kind of a mouthful. If you want some sample code I’ll find some.
Whats up man. Yea i had thought of doing something like that but my second column will only have 2 types of variables…xref or geo…so i’d have to technically do 2 sorts, one to put all the xref’s in order alphabetically and then also with the geo column
Which i was kind of hoping that the ActiveX could do it for me…because after that i have to resort my hashtable that is linked to my ActiveX control…yea, like you said it, a mouth full.
Thanks for the reply though.
I don’t quite understand your problem I think. You have 2 columns, or 3 columns? Is the hashtable you refer to a MXS array or something else?
yea, i thought about that after i posted it, sorry. My activeX listItems are what my
hashtables spit out. yea its a MXS array.
So after i would sort my ListItems manually, i would have to go through and find where the new Listitems are located, and then resort my hashtable to corrispond with the sorting, otherwise some nasty results.
No real big problem i guess, i was just trying to save myself some steps. I guess the qsort is the way to go.
I’m sure i’ve still confused you, don’t worry about it.
Laters
hehe no I got it this time
It is a pain to do it, I agree, but I don’t know of another way aside from the one I posted. Good luck,