How do I detect a USB drive letter from a c# application?

Total Post:28

Points:196
C# 
C#
 2423  View(s)
Ratings:
Rate this:

How to detect the USB drive letter from c# program which is not residing in the USB?

  1. Post:51

    Points:359
    Re: How do I detect a USB drive letter from a c# application?

    Below line of code will get all of the removable drives attached (including USB drives):

    foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
    
    {
        if (driveInfo.DriveType == DriveType.Removable)
        {
            // Code here
        }
    }

      Modified On Apr-03-2018 05:15:57 AM

Answer