Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleList the system's disk drives in VB .NET using GetLogicalDrives
Keywordsdisk, drive, list
CategoriesTips 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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated