By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,578 Members | 1,800 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,578 IT Pros & Developers. It's quick & easy.

ListView images will not show!

P: n/a
OK, I am stumped. I cannot for the life of me get images to show in
ListView items while the view is set to Details. I create an
ImageList, set the SmallImageList to point to the ImageList, then in my
code I do the following to add items to the ListView.

lvi = New ListViewItem
With lvi
.Text = "xxxxx"
.SubItems.Add("yyyy")
.ImageIndex = 1
End With

This is a simplistic snippet of my code. I expect all the items I add
this way will show the image at index 1 from the ImageList. Nothing
shows. Seems there is a placeholder, but no image. I've tried every
combination I can think of. Ideas? TIA... Steve

Feb 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi steve,

First of all, please make sure of the following points :

1. Make sure your ListView.View property is set to Details view. (I think
you've done this.)

2. Make sure that you have the correct ImageList name as the
ListView.SmallImageList property.

3. Make sure to add Column headers using the Columns property. If this is
not possible at design time, create them at run-time,
but BEFORE you start adding list item values.

4. It worked for me, your code was slightly erroneous, so try this : (I am
assuming an ImageList with 3 images)
------------------------------------------------------
Dim i As Integer
For i = 0 To 3
Dim lvi = New ListViewItem()
With lvi
.Text = "Ein"
.SubItems.Add("stein")
.ImageIndex = i
End With
LV.Items.Add(lvi)
Next

------------------------------------------------------

Regards,

Cerebrus.
"Steve" <st*********@eglin.af.mil> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
OK, I am stumped. I cannot for the life of me get images to show in
ListView items while the view is set to Details. I create an
ImageList, set the SmallImageList to point to the ImageList, then in my
code I do the following to add items to the ListView.

lvi = New ListViewItem
With lvi
.Text = "xxxxx"
.SubItems.Add("yyyy")
.ImageIndex = 1
End With

This is a simplistic snippet of my code. I expect all the items I add
this way will show the image at index 1 from the ImageList. Nothing
shows. Seems there is a placeholder, but no image. I've tried every
combination I can think of. Ideas? TIA... Steve

Feb 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.