Click here to Skip to main content
12,693,757 members (34,759 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
I'm writing an application which would detect usb mass storage drives for data storage. I've come up with this code
foreach(DriveInfo mydrive in DriveInfo.GetDrives())
{
if(mydrive.DriveType == DriveType.Removable)
{
...
}
}

This works fine when i have a refresh button to go through the piece of code. But i want to make it to detect new drives as soon as they're plugged-in. Can someone help me out with this. Thanks in advance.
Posted 13-Jan-13 0:39am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Look here: Detecting USB Drive Removal in a C# Program[^]. The article is covering device insertion also.
  Permalink  
Comments
Emejulu JVT 13-Jan-13 6:11am
   
Thanks alot. This a good place to start.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.170118.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100