VB.NET Identify a Removable Hard Drive

VB.NET Identify a Removable Hard Drive

Through the method of the class DriveInfo getdrivers and can get the kind of drive.

This example identifies a removable disk drive in VB.NET.

Private Sub BtnFind_Click(sender As System.Object, e As System.EventArgs) Handles BtnFind.Click
 For Each driveType As System.IO.DriveInfo In System.IO.DriveInfo.GetDrives
          If driveType.DriveType = IO.DriveType.Removable Then
             MessageBox.Show(driveType.Name.ToString & "is removable drive")
          End If
 Next
End Sub


More information can be found here: http://msdn.microsoft.com/en-us/library/system.io.driveinfo.aspx .


Other Languages

This article is also available in the following languages:

Italian (it-IT)

 

Leave a Comment
  • Please add 6 and 3 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Luigi Bruno edited Revision 6. Comment: Added the "Other Languages" section.

  • Richard Mueller edited Revision 5. Comment: Removed (en-US) from title, added language tag

  • Ed Price - MSFT edited Original. Comment: Great article! I updated the title casing. Thanks!

Page 1 of 1 (3 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • This would be better suited on the Gallery.  A link to the Gallery is at the top of every Wiki page.

  • Ed Price - MSFT edited Original. Comment: Great article! I updated the title casing. Thanks!

  • Richard Mueller edited Revision 5. Comment: Removed (en-US) from title, added language tag

  • Yes, this could be a useful code snippet for the Gallery.

  • Luigi Bruno edited Revision 6. Comment: Added the "Other Languages" section.

Page 1 of 1 (5 items)