Thursday, 22 March 2012

List All Folders in specified Drive or Folder



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'make a reference to a directory
        Dim dir As New System.IO.DirectoryInfo("c:\")
        Dim dir1 As System.IO.DirectoryInfo() = dir.GetDirectories()
        Dim directory As System.IO.DirectoryInfo
        'list the names of all folders in the specified drive or Directory
        For Each directory In dir1
            ListBox1.Items.Add(directory)
        Next
    End Sub

No comments:

Post a Comment