[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Check before UnMapping Network Drive Letter

I have the following code to Un-Map a drive letter.  What I would like assistance with is code to determine if DriveLetter is actually a mapped network drive.

Public Function UnMapDrive(ByVal DriveLetter As String) As Boolean
          Dim rc As Integer


''''''' - code here to determine if DriveLetter is actually a mapped network drive '''''''


            rc = WNetCancelConnection2(DriveLetter & ":", 0, ForceDisconnect)

                 If rc = 0 Then
                Return True
            Else
                Return False
            End If

          End Function
0
gpchicago08
Asked:
gpchicago08
1 Solution
 
dericstoneCommented:
Try using System.IO.DriveInfo class and looking at DriveType.

http://msdn.microsoft.com/en-us/library/system.io.drivetype(v=VS.90).aspx
0
 
gpchicago08Author Commented:
PERFECT! Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now