Reputation: 874
I have some list of image url inside my XML file and I want to display them dynamically using ListView control. I can display those images but the problem is it doesn't loop. My ListView only show the first images.
Here is my coding that I did so far.
For i = 0 To 9
Title = myList(0, i, 0) 'Path of image title inside my array
Img = myList(0, i, 2) 'Path of image url inside my array
If Title <> "" Then
ImageList1.Images.Add("imgKey", New Icon(Img))
ListView1.Items.Add(Title, "imgKey")
End If
Next
Image title is looping normally but the image doesn't loop so if like I got 3 types of images inside my XML file, when display into ListView, all images are shown with the same image (only the first image - refer to my XML file).
Why is it like that? I'm looking forward your help. Thank you.
Upvotes: 1
Views: 366
Reputation: 874
Thank you so much to @Steven Doggart
for the solution.
Here is my coding that working all fine now.
For i = 0 To 9
Title = myList(0, i, 0) 'Path of image title inside my array
Img = myList(0, i, 2) 'Path of image url inside my array
If Title <> "" Then
ImageList1.Images.Add("imgKey" & i, New Icon(Img))
ListView1.Items.Add(Title, "imgKey" & i)
End If
Next
Upvotes: 1