I'm trying to get the Imageindex value of the image on each line of a Listview box, but nothing I've tried is working.
Can someone point me in the right direction? I'm sure this is pretty simple.
Thanks,
~ Chazz
Printable View
I'm trying to get the Imageindex value of the image on each line of a Listview box, but nothing I've tried is working.
Can someone point me in the right direction? I'm sure this is pretty simple.
Thanks,
~ Chazz
Loop through the Items collection and get the ImageIndex of each item.
I'm sure I'm doing this totally wrong, but this is what I have.
The message box just gives me a blank message.Code:For i = 0 To ListView1.Items.Count - 1
Dim value As StringNext
value = ListView1.Items(i).ImageKey
MsgBox(value)
Did you set the ImageKey for the items? If the messages are blank then presumably not. Your origianl post says you want the ImageIndex, which is not the same thing. Setting one has no effect on the other.
This is what I'm using to add the items to the list. It seems to work ok, adds the image perfectly.
Code:Dim LVitem As ListViewItem
LVitem = New ListViewItem(" WEATHER: ", 6)
Sure it does. You're telling it which Image to use by index, not by key, so the ImageIndex property is set but not the ImageKey property.
Thanks for your help jmcilhinney, I just started playing with Listviews yesterday, I've always used Listboxes so I've been trying to teach myself how to use Listviews now.
GOT IT!
Thanks jmcilhinney! I guess I was confusing Imageindex and Imagekey.
Thanks again!