I often cheat and do something like:
Me.ListView1.SmallImageList.Images.Add(MyNewItemIc on)
Me.ListView1.Items.Add(MyItemText,
Me.ListView1.SmallImageList.Images.Count - 1)
First it adds the image I want to use to the ListView's small image list.
Then it adds a new item and points the image to the last image in the small
image list, which is the one I just added. I don't recommed this if you're
going to be adding a lot of images because it will end up eating a lot of
memory. It should be fine if you're just doing a runtime population of the
control and won't be adding more afterwards.
"Simon Morris" <nz*********@hotmail.com> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
How do you add I icon to a ListView at run time, the icon is in a
ImageList (ImageIndex = 0)? I am using the follow code to add item.
Dim item4 As New ListViewItem("Load Island Data", 1)
item4.SubItems.Add(Format(Microsoft.VisualBasic.Ti mer - sngStartTime,
"0.0" & " sec"))
item4.SubItems.Add("All map data loaded in to memory")
TaslList.Items.AddRange(New ListViewItem() {item4})