Skip to main content

How to Display All Drives into the ListView Using VB.Net

This tutorial that I’m going to teach you is about how to display all drives into the listview using Vb.Net. This method is useful when you have to display the computer drives in the listview. With this, you will be able to see and have an idea what drives are available on your computer. Simply follow the instructions below and you will be done in no time.

Creating Application

Step 1

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

Step 2

Do the Form just like shown below.

Step 3

Go to the code view, create a sub procedure for retrieving all drives.

  1. Private Sub retrieveDrives()
  2. ListView1.Items.Clear()
  3. Dim inc As Integer = 0
  4. For Each drive As IO.DriveInfo In IO.DriveInfo.GetDrives
  5. Dim drivename As String = drive.Name
  6. Dim driveType As String = ""
  7. Dim driveltr As String = drive.Name
  8. If drive.IsReady AndAlso drive.VolumeLabel <> "" Then
  9. drivename = drive.VolumeLabel
  10. Else
  11. Select Case drive.DriveType
  12. Case IO.DriveType.Fixed : drivename = "Local Disk"
  13. Case IO.DriveType.CDRom : drivename = "CD-ROM"
  14. Case IO.DriveType.Network : drivename = "Network Drive"
  15. Case IO.DriveType.Removable : drivename = "Removable Disk"
  16. End Select
  18. End If
  19. Select Case drive.DriveType
  20. Case IO.DriveType.Fixed : driveType = "Local Disk"
  21. Case IO.DriveType.CDRom : driveType = "CD-ROM"
  22. Case IO.DriveType.Network : driveType = "Network Drive"
  23. Case IO.DriveType.Removable : driveType = "Removable Disk"
  24. End Select
  25. ListView1.Items.Add(drivename)
  26. ListView1.Items(inc).SubItems.Add(driveltr)
  27. ListView1.Items(inc).SubItems.Add(driveType)
  28. inc += 1
  29. Next
  30. End Sub

Step 4

Double click the button and call the method that you have created to execute when the button is clicked.

  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2. retrieveDrives()
  3. End Sub

For more question about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
FB Account –
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.

Add new comment

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