Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm writing an application which would detect usb mass storage drives for data storage. I've come up with this code
C#
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

1 solution

Look here: Detecting USB Drive Removal in a C# Program[^]. The article is covering device insertion also.
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900