Skip to main content

How to Add Images in a ListView Using VB.Net

This time, I will teach you how to add images in a ListView using VB.Net.The ListView is an object that can handle the data that will be displayed in a list form. So, this program will illustrate how to display a list of data with images in a ListView by adding it programmatically. Let’s begin.

Creating Application

Step 1

Open Microsoft Visual Studio 2015 and create a new windows form application.

Step 2

Add a ListView inside the form and do the form just like shown below.

Step 3

Press F7 to open the code editor. In the code editor, declare an item in the listview control and an image list to control an image object.

  2. Dim lstviewItem As ListViewItem
  3. Dim lstviewItemImageList As ImageList = New ImageList()

Step 4

Create a method for populating the data with images in the listview.

  2. Private Sub load_data()
  3. Try
  4. 'set the properties of the listview
  5. ListView1.View = View.Details
  6. ListView1.Columns.Add("Pictures")
  7. ListView1.Columns(0).Width = 500
  9. 'declare a string array
  10. Dim imageList() As String
  11. 'add a values in the array
  12. imageList = New String() {"meme 1.png", "meme 2.jpg", "meme 3.png", "meme 4.jpg", "meme 5.jpg", "meme 6.png"}
  14. 'display an array values in the listview
  15. For Each images As String In imageList
  16. lstviewItem = New ListViewItem(Application.StartupPath & "/memes/" & images)
  17. lstviewItemImageList.ImageSize = New Size(100, 100)
  18. ListView1.SmallImageList = lstviewItemImageList
  19. lstviewItem.ImageIndex = lstviewItemImageList.Images.Add(Image.FromFile(lstviewItem.Text), Color.Transparent)
  20. ListView1.Items.Add(lstviewItem)
  21. Next
  23. Catch ex As Exception
  24. 'catching error
  25. MessageBox.Show("error : " + ex.Message)
  26. End Try
  27. End Sub

Step 5

Write the following code execute the method that you have created in the first load of the form.

  2. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  3. 'display the data in the listview in the first load of the form
  4. load_data()
  5. End Sub

The complete source code is included. You can download it and run it on your computer.
For any questions about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
Or feel free to comment below.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Submitted byArko (not verified)on Sat, 04/11/2020 - 23:55

What if I want my list to appear in list of items, not the path of images

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.