Click here to Skip to main content
Rate this: bad
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
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.
Emejulu JVT at 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
0 DamithSL 295
1 OriginalGriff 285
2 Sergey Alexandrovich Kryukov 157
3 Afzaal Ahmad Zeeshan 154
4 Peter Leow 115
0 OriginalGriff 7,510
1 DamithSL 5,494
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514

Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2014
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