|
|
Title | List the system's disk drives in VB .NET using GetLogicalDrives |
Keywords | disk, drive, list |
Categories | Tips and Tricks |
|
|
Use System.IO.Directory.GetLogicalDrives() to get an array of strings listing the drives. This example loops through the array adding the drives to a ListBox.
|
|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles MyBase.Load
Dim dirs() As String = _
System.IO.Directory.GetLogicalDrives()
Dim i As Long
For i = dirs.GetLowerBound(0) To dirs.GetUpperBound(0)
lstDrives.Items.Add(dirs(i))
Next i
End Sub
|
|
|
|
|
|