|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ListView images will not show!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 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. Show quoteHide quote "Steve" <steven.m***@eglin.af.mil> wrote in message news:1139945864.306187.135410@g47g2000cwa.googlegroups.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 > |
|||||||||||||||||||||||