Order all row in listview based the index of ICO

User avatar
sal21
PlatinumLounger
Posts: 4370
Joined: 26 Apr 2010, 17:36

Order all row in listview based the index of ICO

Post by sal21 »

I use this piece of code to ad icon in first column

...
Set itmX = Me.ListView2.ListItems.Add(, , RS.Fields("DATA_OP").Value, ICO)
....

is possible to order all rows based the index of ICO?

i need to assign the ordering routine to a button, Button1 for ICO=with index image 1, Button2 for ICO=with index image 2

note:
I can have only 2 ICO in imagelist1

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Order all row in listview based the index of ICO

Post by HansV »

Perhaps you can modify the code from http://forums.devx.com/showthread.php?1 ... n-listview" onclick="window.open(this.href);return false;.
I can't help you with this question.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4370
Joined: 26 Apr 2010, 17:36

Re: Order all row in listview based the index of ICO

Post by sal21 »

HansV wrote:Perhaps you can modify the code from http://forums.devx.com/showthread.php?1 ... n-listview" onclick="window.open(this.href);return false;.
I can't help you with this question.

GOOGLING....
....
Me.ListView1.SortKey = 11
If Me.ListView1.SortKey = 1 Then Me.ListView1.SortKey = 11
Me.ListView1.SortOrder = (Me.ListView1.SortOrder - 1) * -1
Me.ListView1.Sorted = True
....
Me.ListView1.Sorted = False

wath you think about (my real column is the 11th) This column is hidden and i fill, with the value of ICO 1 or 2, during the code fiil the listview.
In effect is only a Service Column to use the ordering routine

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Order all row in listview based the index of ICO

Post by HansV »

That should work, I think.
Best wishes,
Hans