Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: KrAzY_NuK on March 21, 2006, 11:03 AM

Title: Sorting VB6 ListViews
Post by: KrAzY_NuK on March 21, 2006, 11:03 AM
Hey all, Haven't been around in a while.

Quick question.  I've done some searching on google, and within this form, and haven't found an answer.

Using VB6, does anybody know if it's possible to sort a ListView by it's Tag property?

I know how to sort by any of the viewable columns, that's easy, but I can't seem to find any way to sort by tag.

Thanks,
Glenn
Title: Re: Sorting VB6 ListViews
Post by: Grok on March 21, 2006, 02:35 PM
I have never heard of that being done.  Why do you think it is possible?  I could see creating a columnheader with the value from tag in it, but you already know you could do that.
Title: Re: Sorting VB6 ListViews
Post by: RealityRipple on March 21, 2006, 03:12 PM
Not very hard. Here's a link to an example:
http://realityripple.com/MyStuff/TagSortExample.zip

btw, the sorting method i used was a SelectionSort... I guess you could sort it using other methods, but Selections always seemed cleanest to me.
Title: Re: Sorting VB6 ListViews
Post by: KrAzY_NuK on March 21, 2006, 06:19 PM
Grok:
I was just hoping it was possible.  Instead, I just added a hidden column.

RealityRipple:
Thanks for that, but I was hoping to use the built in VB stuff.  I'll check out your example later though.
Title: Re: Sorting VB6 ListViews
Post by: topaz on March 21, 2006, 07:47 PM
I don't think there's an inherent function for it - instead, you could write a function that copies all the tags to an array and sort it from there.