PC Review


Reply
Thread Tools Rate Thread

Directory.GetDirectories method and IOException

 
 
Carl Rapson
Guest
Posts: n/a
 
      21st Oct 2004
I have some code that is checking a directory for subdirectories, using the
Directory.GetDirectories method (I got this code from a sample app):

Dim directories as String()
Try
directories = Directory.GetDirectories(path)
Catch ex as System.IO.IOException
End Try

When path is set to "A:\" (the floppy drive), and there is no disk in the
drive, I am getting the following error message box: "There is no disk in
the drive. Please insert a disk into drive A:." As far as I can tell, this
is the "drive not ready" error, which I thought should be handled by
catching IOException. I only get this error for the floppy (A drive; I
don't get this error for my CD-ROM drive, even though there's no disk in the
CD drive. Furthermore, I only get this message when I am running outside of
Debug mode; in Debug mode, I don't see this error message. If I remove the
catch for IOException, I see a message saying "The device is not ready" in
both modes, but I still only see the first message when in non-Debug mode.

Why isn't this error being caught by IOException? How can I avoid this
message when there is no disk in drive A:?

Thanks for any information,

Carl Rapson


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Alternative to Directory.GetDirectories? Tom Shelton Microsoft VB .NET 0 28th Jan 2010 07:10 PM
Re: Alternative to Directory.GetDirectories? Andrew Morton Microsoft VB .NET 0 28th Jan 2010 04:11 PM
Re: Strange behaviour with Directory.GetDirectories Otis Mukinfus Microsoft C# .NET 0 8th Jan 2007 11:35 AM
DirectoryInfo.GetDirectories method =?Utf-8?B?TWljaGFlbEg=?= Microsoft Dot NET 0 7th Jul 2005 04:01 PM
Directory.GetDirectories display order =?Utf-8?B?TWlrZSBE?= Microsoft ASP .NET 1 30th Mar 2005 09:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:13 AM.