Media removed

S

Samuel

Hi everyone,

If while I copy files to memory pen the user pulls out the device, I get an
exception saying 'path can't be found' (the exception occurred in the line
of code that creates a folder)

Instead I would like to show the user a message and carry on with the work.
The only way I can figure out is to catch the exception and present a
message box requesting the media in place before the user click on the OK
button.

I wonder what else is available, perhaps something similar to these messages
one gets when installing VS from multiple CDs or even when the CD is taken
out while the installation takes place

Thank you,
Samuel
 
G

Guest

AFAIK, catching the exception is your only option, unless you want to
interface directly with the OS to catch the problem. Now, you obviously have
the option of doing whatever you want to do when catching the exception, so
why not add some custom logic to your catch block? What I mean is that you
recover from the exception, by asking the user to insert the device, and the
you start copying again. If you have several files, why not keep an array of
files that have been successfully copied, and then if you catch the
exception restart the copying from wherever it failed? Just a thought.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top