Images in a listview

Lanc1988

Contributor
Joined
Nov 27, 2003
Messages
508
I have a listview set to details view and im using the following code on Form Load to add items and subitems to the list but I would like to have a small image in front of each item but I can't figure out the code to do that

Visual Basic:
        ListView1.Items.Add("Overall")
        ListView1.Items(0).SubItems.Add(SubVals(0))
        ListView1.Items(0).SubItems.Add(SubVals(1))
        ListView1.Items(0).SubItems.Add(SubVals(2))
        ListView1.Items.Add("Attack")
        ListView1.Items(1).SubItems.Add(SubVals(0))
        ListView1.Items(1).SubItems.Add(SubVals(1))
        ListView1.Items(1).SubItems.Add(SubVals(2))
 
i was able to get my images on the items with no problem but now I can figure out how to get an image on the subitems.

To get the image on the item i used
ListView1.Items.Add("Overall").ImageIndex = 15

So i thought for the subitem i would just use
ListView1.Items(0).SubItems.Add(OveR - SubVals(0)).ImageIndex = 20

but it doesnt work for the subitems.. what is the code for the subitems?
 
Back
Top