Im trying to fill a listview(tiles) with posters and titles of a DVD collection but only the titles become vissible.
this is my code:
Private Sub fillListView(ByVal listView As System.Windows.Forms.ListView, ByVal col As Collection)
listView.Items.Clear()
myImageList = New ImageList()
For Each item As bsDVD In col
Try
myImageList.Images.Add(Image.FromFile(Application.StartupPath & item.PosterURL))
Catch ex As Exception
MessageBox.Show(ex.message)
End Try
Next
myImageList.ImageSize = New Size(32, 32)
listView.LargeImageList = myImageList
For Each item As bsDVD In col
listView.Items.Add(item.Titel)
Next
End Sub
Tried a lot cant get it working:(. Did i make a stupid mistake or? hope someone can help me.
ty in advance
ty both for helping me out...
solution code:
Private Sub fillListView(ByVal listView As System.Windows.Forms.ListView, ByVal col As Collection)
listView.Items.Clear()
myImageList = New ImageList()
myImageList.ImageSize = New Size(70, 100)
myImageList.ColorDepth = ColorDepth.Depth24Bit
For Each item As bsDVD In col
Try
myImageList.Images.Add(Image.FromFile(Application.StartupPath & item.PosterURL))
Catch ex As Exception
MessageBox.Show("Kan afbeelding niet inladen!")
End Try
Next
listView.LargeImageList = myImageList
Dim mItem As bsDVD
For i As Integer = 1 To col.Count
mItem = CType(col.Item(i), bsDVD)
listView.Items.Add(mItem.Titel)
listView.Items(i - 1).ImageIndex = (i - 1)
Next
End Sub