Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load For Each dri As System.IO.DriveInfo In System.IO.DriveInfo.GetDrives ListBox1.Items.Add(dri) Next End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged ListBox2.Items.Clear() Try Dim dri As System.IO.DriveInfo = DirectCast(ListBox1.SelectedItem, System.IO.DriveInfo) For Each dirInfo As System.IO.DirectoryInfo In dri.RootDirectory.GetDirectories() ListBox2.Items.Add(dirInfo) Next Catch ex As Exception MsgBox(ex.Message) End Try End Sub
Private Sub ListBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox2.SelectedIndexChanged ListBox3.Items.Clear() Try Dim dirinfo As System.IO.DirectoryInfo = DirectCast(ListBox2.SelectedItem, System.IO.DirectoryInfo) For Each f As System.IO.FileInfo In dirinfo.GetFiles() ListBox3.Items.Add(f) Next Catch ex As Exception MsgBox(ex.Message) End Try End Sub