O
Olaf Rabbachin
Hi folks,
I'm copying files from i.e. a memory-card to the hard-drive.
The code roughly looks like this abstract:
Dim di As New DirectoryInfo("E:\")
Dim fi As FileInfo
Try
For Each fi In di.GetFiles
'...
Next
Catch ...
End Try
I would've expected that the above code would catch all exceptions,
including i.e. the one thrown if the user retracts the memory-card during
the process. However, if the disk is removed during di.GetFiles I'll get a
standard messagebox "There is no disk in the drive. Please insert a disk
into drive \Device\Harddisk1\DR3" and the Catch-block will be executed
after the user clicked any of the messagebox's buttons.
That's exactly what shouldn't ever happen.
Any suggestions?
TIA & cheers,
Olaf
I'm copying files from i.e. a memory-card to the hard-drive.
The code roughly looks like this abstract:
Dim di As New DirectoryInfo("E:\")
Dim fi As FileInfo
Try
For Each fi In di.GetFiles
'...
Next
Catch ...
End Try
I would've expected that the above code would catch all exceptions,
including i.e. the one thrown if the user retracts the memory-card during
the process. However, if the disk is removed during di.GetFiles I'll get a
standard messagebox "There is no disk in the drive. Please insert a disk
into drive \Device\Harddisk1\DR3" and the Catch-block will be executed
after the user clicked any of the messagebox's buttons.
That's exactly what shouldn't ever happen.
Any suggestions?
TIA & cheers,
Olaf