0 out of 1 rated this helpful - Rate this topic

How to: Determine a Drive's Type in Visual Basic

The 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 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)
    
    
    
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Advertisement