|
-
Dec 16th, 2008, 08:20 PM
#1
Thread Starter
Lively Member
[RESOLVED] Getting Imageindex from Listview?
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
-
Dec 16th, 2008, 08:40 PM
#2
Re: Getting Imageindex from Listview?
Loop through the Items collection and get the ImageIndex of each item.
-
Dec 16th, 2008, 09:38 PM
#3
Thread Starter
Lively Member
Re: Getting Imageindex from Listview?
I'm sure I'm doing this totally wrong, but this is what I have.
Code:
For i = 0 To ListView1.Items.Count - 1
Dim value As String
value = ListView1.Items(i).ImageKey
MsgBox(value) Next
The message box just gives me a blank message.
-
Dec 16th, 2008, 09:45 PM
#4
Re: Getting Imageindex from Listview?
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.
-
Dec 16th, 2008, 09:48 PM
#5
Thread Starter
Lively Member
Re: Getting Imageindex from Listview?
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)
-
Dec 16th, 2008, 10:02 PM
#6
Re: Getting Imageindex from Listview?
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.
-
Dec 16th, 2008, 10:05 PM
#7
Thread Starter
Lively Member
Re: Getting Imageindex from Listview?
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!
Last edited by lithiumdm; Dec 16th, 2008 at 10:23 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|