By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,666 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

Programmatically read file(s) from a USB device

P: n/a
Suppose I have one of those USB storage devices (like a mp3 player, USB
thumbdrive, or even digital camera) connected to my computer. I'd like
to write a C# program that can

- detect that the USB device is connected, and then
- read file(s) from that USB device.

How can I do that? Any reference?

Thanks a lot in advance
Dom

Nov 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

<do****@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Suppose I have one of those USB storage devices (like a mp3 player, USB
thumbdrive, or even digital camera) connected to my computer. I'd like
to write a C# program that can

- detect that the USB device is connected, and then
- read file(s) from that USB device.


It's just a disk drive; you read files the same way as from any other disk.
Nov 22 '05 #2

P: n/a
Thanks for your reply.

When I plug in my USB drive, a pop-up saying "USB device detected" will
be displayed and then the USB drive will be displayed as a new drive
letter. How can I find out that the USB device is detected / connected?
Also, which drive letter has it been assigned to?

Dom

Nov 22 '05 #3

P: n/a
I am not sure if this would help, but there is a library available from
the makers of SharpDevelop [a free IDE for .NET] called sharpusblib.
Just google the name and visit their site, to see if it will be of
help to you...

Nov 22 '05 #4

P: n/a
Hi dom, this has been discussed before, and it can be a bit involved,
but there are two topics in this group
(microsoft.public.dotnet.languages.csharp) which helped me when i was
looking.

'c# code detect inset/remove events at usb port'
'get drive letter( Win32_Diskdrive)'

If you searched (i'm on googlegroups) there are code examples. if you
can't find them, let me know, i'll dig out my code :)

Nov 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.