Detect if any USB drive is detected or not using WinForm Application in Visual C#
Posted
by Pavan Kumar
on Stack Overflow
See other posts from Stack Overflow
or by Pavan Kumar
Published on 2010-05-22T05:26:38Z
Indexed on
2010/05/22
5:40 UTC
Read the original article
Hit count: 465
I want to do the following things in my application
1) I want to display whether any USB drive is inserted or not in my application to prompt the user to insert a USB drive. I just want to notify the user if any USB dirve is inserted else prompt him to insert one using a label or something (i want to avoid messagebox as it will keep appearing whenever a device is inserted or removed. It will be irritating for the end user) in my Visual C# WinForm Application. If any USB drive is present display "USB drive detected" in the label. The user may add one or more USB sticks but the status will remain same. When there is none then the status of the label will change to "No USB drives found.Please insert a USB drive".
2) When one or more USB drive is added the volume name with the drive letter for example "James(F:)" is added to the Combobox list. The combobox list also needs to remove the entry for the USB drive added in the list automatically when it is removed . So when there is no USB the list should be empty and the label will again prompt user to insert a USB stick or drive.
© Stack Overflow or respective owner