Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

DriveTypes (Enums)
 
.
Summary

C# Definition:

public enum DriveTypes

{

    DRIVE_UNKNOWN     = 0,
    DRIVE_NO_ROOT_DIR = 1,
    DRIVE_REMOVABLE   = 2,
    DRIVE_FIXED       = 3,
    DRIVE_REMOTE      = 4,
    DRIVE_CDROM       = 5,
    DRIVE_RAMDISK     = 6

}

VB Definition:

Public Enum DriveTypes

    DRIVE_UNKNOWN = 0
    DRIVE_NO_ROOT_DIR = 1
    DRIVE_REMOVABLE = 2
    DRIVE_FIXED = 3
    DRIVE_REMOTE = 4
    DRIVE_CDROM = 5
    DRIVE_RAMDISK = 6

End Enum

Enum DriveTypes
   TODO
End Enum

VB.Net How to get the Drives and their Type. Here is code under the Button1.Click event Sub.

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim allDrivesDriveInfo As System.Collections.ObjectModel.ReadOnlyCollection(Of System.IO.DriveInfo)
    allDrivesDriveInfo = My.Computer.FileSystem.Drives
    'Another way to get the Drives is:>>
    Dim myDrives() As System.IO.DriveInfo = System.IO.DriveInfo.GetDrives
    For Each d As System.IO.DriveInfo In myDrives
        Select Case d.DriveType
        Case System.IO.DriveType.Unknown
            'Your code here.>>
        Case System.IO.DriveType.NoRootDirectory
            'Your code here.>>
        Case System.IO.DriveType.Removable
            'Your code here.>>
        Case System.IO.DriveType.Fixed
            'Your code here.>>
        Case System.IO.DriveType.Network
            'Your code here.>>
        Case System.IO.DriveType.CDRom
            'Your code here.>>
        Case System.IO.DriveType.Ram
            'Your code here.>>
        End Select
        If d.DriveType = System.IO.DriveType.CDRom And d.Name = "D:\" Then
        'Your code here.>>
        End If
    Next
    End Sub
End Class

Notes:

None.

Documentation
DriveTypes on MSDN
 

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it!

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions