4/22/11

[VB.NET][SNP] Listing All USB Drives

Imports System.IO 
 Public Function usbdrives() As Boolean 
     Dim drives() As DriveInfo = DriveInfo.GetDrives() 
     For Each found As DriveInfo In drives 
       If found.DriveType = "2" And found.IsReady = True Then 
                MsgBox("USB Drive: " & found.Name) 
       End If 
     Next found 
     Return True 
End Function 

This code will pop a message box for each usb drive it found's on your PC.

No comments: