How to: Determine a Drive's Type in Visual Basic
The My.Computer.FileSystem.GetDriveInfo Method provides a DriveInfo object that can be queried for information about a drive on a computer. You can use the DriveType property to determine the drive's type. Attempting to access the property without sufficient permission throws a SecurityException exception.
For more information about the which drive types are recognized, see DriveType.
To determine the type of a drive
Use the DriveType property to determine the type, as illustrated in the following code.
Dim cdrive As System.IO.DriveInfo cdrive = My.Computer.FileSystem.GetDriveInfo("C:\") MsgBox(cdrive.DriveType.ToString)
See Also
Tasks
How to: Determine a Drive's Total Space in Visual Basic
How to: Determine a Drive's Volume Label in Visual Basic