다음을 통해 공유


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)