J
Jim Heavey
Is there some way for me to identify if a particular drive is a CDROM or a
Floppy drive or a local or network drive?
Floppy drive or a local or network drive?
Jim Heavey said:Is there some way for me to identify if a particular drive is a CDROM
or a Floppy drive or a local or network drive?
Jim Heavey said:Is there some way for me to identify if a particular drive is a CDROM or a
Floppy drive or a local or network drive?
Herfried K. Wagner said:Hello,
Jim Heavey said:Is there some way for me to identify if a particular drive is a CDROM or a
Floppy drive or a local or network drive?
Set a reference to System.Management.dll
\\\
Imports System.Management
.
.
.
Public Enum DriveType
Unknown = 0
NoRootDirectory = 1
RemoveableDisk = 2
LocalDisk = 3
NetworkDrive = 4
CompactDisk = 5
RamDisk = 6
End Enum
Public Function GetDriveType(ByVal strDrive As String) As DriveType
strDrive = "Win32_LogicalDisk='" & strDrive.Substring(0, 2) & "'"
Dim moDisk As ManagementObject = New ManagementObject(strDrive)
Return _
DirectCast( _
[Enum].Parse(GetType(DriveType),
moDisk("DriveType").ToString()), _
DriveType _
)
End Function
.
.
.
Dim astrDrives() As String = Environment.GetLogicalDrives()
Dim strDrive As String
For Each strDrive In astrDrives
MessageBox.Show( _
"Drive: " & strDrive & ControlChars.NewLine & _
"Type: " & GetDriveType(strDrive).ToString() _
)
Next strDrive
///
HTH,
Herfried K. Wagner