title: disconnecting mapped drive vb
body: <p>i have mapped a network drive using a function that finds next available letter drive and then maps it using net use z: \server\z , how do i disconnect all network drives and not just specifically z ? thank you for any help . p.s. i'm new to all this :)</p>
  
  <pre><code>    Dim alphabet As New System.Collections.Specialized.StringCollection()
  
  
      Dim lowerBound As Integer = Convert.ToInt16("g"c)
      Dim upperBound As Integer = Convert.ToInt16("z"c)
      For i As Integer = lowerBound To upperBound - 1
          Dim driveLetter As Char = ChrW(i)
          alphabet.Add(driveLetter.ToString())
      Next
  
      lowerBound = Convert.ToInt16("a"c)
      upperBound = Convert.ToInt16("i"c)
      For i As Integer = lowerBound To upperBound - 1
          Dim driveLetter As Char = ChrW(i)
          alphabet.Add(driveLetter.ToString())
      Next
  
      ' get all current drives
      Dim drives As System.IO.DriveInfo() = System.IO.DriveInfo.GetDrives()
      For Each drive As System.IO.DriveInfo In drives
          alphabet.Remove(drive.Name.Substring(0, 1).ToLower())
      Next
  
      For Each s As String In alphabet
          If System.IO.Directory.Exists(s) = False Then
              Return s
          End If
      Next
  </code></pre>