listview control
and an image list
to control an image object.
Dim lstviewItem As ListViewItem Dim lstviewItemImageList As ImageList = New ImageList()
Private Sub load_data() Try 'set the properties of the listview ListView1.View = View.Details ListView1.Columns.Add("Pictures") ListView1.Columns(0).Width = 500 'declare a string array Dim imageList() As String 'add a values in the array imageList = New String() {"meme 1.png", "meme 2.jpg", "meme 3.png", "meme 4.jpg", "meme 5.jpg", "meme 6.png"} 'display an array values in the listview For Each images As String In imageList lstviewItem = New ListViewItem(Application.StartupPath & "/memes/" & images) lstviewItemImageList.ImageSize = New Size(100, 100) ListView1.SmallImageList = lstviewItemImageList lstviewItem.ImageIndex = lstviewItemImageList.Images.Add(Image.FromFile(lstviewItem.Text), Color.Transparent) ListView1.Items.Add(lstviewItem) Next Catch ex As Exception 'catching error MessageBox.Show("error : " + ex.Message) End Try End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'display the data in the listview in the first load of the form load_data() End Sub