locked
VB.Net Get Mapped Drive Folders RRS feed

  • Question

  • hi gurus, i found this code to list the mapped drives.

    Dim drive As System.IO.DriveInfo

            For Each drive In System.IO.DriveInfo.GetDrives()
                If drive.DriveType = IO.DriveType.Network Then
                    ListBox1.Items.Add(drive.Name)
                End If
            Next

    How do I get the folders on the mapped drive?

    Like if I click on P drive, how do I get the name of the folders on P drive?


    Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.

    Wednesday, November 20, 2013 10:01 AM

Answers

  • Something like this? 

    using System.IO ; 
    
    foreach ( Directory dir in Directory.GetDirectories( "P:\" ) ) 
    {
       ListBox2.Items.Add( dir.Name ); 
    }
    


    Regards, Phill W.

    • Marked as answer by cguan Thursday, November 21, 2013 5:24 AM
    Wednesday, November 20, 2013 1:50 PM

All replies

  • Something like this? 

    using System.IO ; 
    
    foreach ( Directory dir in Directory.GetDirectories( "P:\" ) ) 
    {
       ListBox2.Items.Add( dir.Name ); 
    }
    


    Regards, Phill W.

    • Marked as answer by cguan Thursday, November 21, 2013 5:24 AM
    Wednesday, November 20, 2013 1:50 PM
  • Thanks Phill :)

    Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.

    Thursday, November 21, 2013 5:41 AM