How to: Determine a Drive's Format
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

How to: Determine a Drive's Format 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 DriveFormat property to determine the drive format. Attempting to access the property without sufficient permission throws a SecurityException exception.

NoteNote:

  The options available in dialog boxes, and the names and locations of menu commands you see, might differ from what is described in Help, depending on your active settings or edition. This Help page was written with General Development Settings in mind. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To determine a drive's format

  • Use the DriveFormat property to determine the drive format, as illustrated in the following code.

    Dim cdrive As System.IO.DriveInfo
    cdrive = My.Computer.FileSystem.GetDriveInfo("C:\")
    MsgBox(cdrive.DriveFormat)
    
Show:
© 2016 Microsoft