Valhalla Legends Forums Archive | Visual Basic Programming | [VB6] Changing ListView's SmallIcons at Run-Time

AuthorMessageTime
DDA-TriCk-E
I am trying to change a ListView's SmallIcon set at run-time when the ListView is populated.  The existing items in the ListView do not update using the new ImageList, however new items do.  Anyone know a way around this?

I am currently doing this with no success:
[code]
Set lvUsers.SmallIcons = imlClassic
lvUsers.Refresh
[/code]
November 12, 2007, 12:22 AM
Barabajagal
Perhaps try doing lvUsers.ListItems(I).SmallIcon = lvUsers.ListItems(I).SmallIcon or something to that effect?
November 12, 2007, 12:42 AM
DDA-TriCk-E
Doesn't work :(
November 12, 2007, 12:49 AM
BreW
Are you trying to change the imagelist?
I suggest doing it by:
SendMessage(lvUsers.hWnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)imlClassic.hWnd);
November 12, 2007, 3:18 AM
DDA-TriCk-E
Thanks I'll have a go at that :)
November 12, 2007, 4:13 AM
DDA-TriCk-E
No good  :(

Edit: Oops forgot to use ByVal in the listviews hWnd, it works now :)
    SendMessage lv.hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, ByVal imlClassic.hImageList
November 12, 2007, 4:34 AM
BreW
Sorry for my VB-C fusion code, but at least it got the idea across. I'm glad it's working.
November 12, 2007, 5:19 AM

Search