Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2010
Visual Studio
Visual Basic
 How to: Determine a Drive's Volume ...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2010/.NET Framework 4

Other versions are also available for the following:
Visual Studio 2010 - Visual Basic
How to: Determine a Drive's Volume Label 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 VolumeLabel property to determine the drive label. Attempting to access the property without sufficient permission throws a SecurityException exception.

NoteNote

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To determine a drive's volume label

  • Use the VolumeLabel property to determine the drive label, as illustrated in the following code.

    Visual Basic
    Dim cdrive As System.IO.DriveInfo
    cdrive = My.Computer.FileSystem.GetDriveInfo("C:\")
    MsgBox(cdrive.VolumeLabel)
    
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker