'Imports System
'Imports System.Runtime.InteropServices
<DllImport("kernel32")> _
Private Function GetDriveType(ByVal lpRootPathName As String) As Integer
End Function
Private Function DriveExists(ByVal sLetter As String) As Boolean
If Not String.IsNullOrEmpty(sLetter) Then
sLetter = sLetter.Substring(0, 1).ToUpper()
If Text.RegularExpressions.Regex.IsMatch(sLetter, "[A-Z]") Then
Dim DriveType As Integer = GetDriveType(String.Format("{0}:\", sLetter))
Return ((DriveType > 1&) And (DriveType < 7&))
End If
End If
Return False
End Function
Coloration syntaxique vb/vba/vb.net