0

I have a c# program saving data to a usb drive, but if the usb is unplugged, there will be a crash. Is there any good way to handle this exception? Thanks!

Ames ISU
  • 167
  • 1
  • 2
  • 12
  • 1
    What is the crash/exception and can you provide the code where you are writing to the drive when the exception occurs? – Ron Beyer Aug 25 '15 at 18:07

1 Answers1

1

The code you are using to write will likely raise an exception which you should be able to capture and respond to accordingly using a try/catch block.

https://msdn.microsoft.com/en-us/library/ms173162.aspx

dinomix
  • 956
  • 4
  • 5