Home > DeveloperSection > Forums > Get list of USB in winform using c#?
Aaron Douglas
Aaron Douglas

Total Post:20

Points:140
Posted on    October-16-2013 7:26 AM

 C# C# 
Ratings:


 1 Reply(s)
 2152  View(s)
Rate this:

I have tried the below line of code to get the USB devices from the computer.

 foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
 {
     if (driveInfo.DriveType == DriveType.Removable)
     {
        comboBoxUSB.Items.Add(driveInfo.Name);
     }
 }

comboBoxUSB is a combobox.. here i am getting this :

 E:/
 G:/

but not getting the device name, like :

 E:/Mindstick 

something like this, how can i get this? is it possible to get this?

please help!



Brad Pitt
Brad Pitt

Total Post:61

Points:429
Posted on    October-16-2013 7:48 AM

foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
 {
     if (driveInfo.DriveType == DriveType.Removable)
     {
        if (drive.IsReady)
                 comboBoxUSB.Items.Add(driveInfo.Name + "-" + driveInfo.VolumeLabel);                                             
     }
 }

Don't want to miss updates? Please click the below button!

Follow MindStick