473,473 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Directory.GetDirectories method and IOException

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
Nov 21 '05 #1
0 2004

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Lee Holsenbeck | last post by:
hi, i am reading the directory structure into a treeview. when i select a new drive and do not have access to an existing folder; i get an acess denied - System.UnauthorizedAccessException...
3
by: S. Han | last post by:
I'm using Directory.GetFiles to enumerate files in a directory. The problem is if you have to enumerate all files + subdirectories recursively, it takes too much memory, and it fails. Is there...
4
by: Elmo Watson | last post by:
Is there a way, with the System.IO class, to do a recursive list of a directory structure? For instance, in DirectoryInfo, you have GetDirectories and GetFiles .... In Directory, you have...
2
by: Manny Chohan | last post by:
Hi Guys, I am currently programming in Vb .net. I am stuck at point. i have a root directory C:\test which has couple of sub-folders c:\test\test1 ; c:\test\test2 ; c:\test\test1\test4 and so...
2
by: Raed Sawalha | last post by:
I have the following function to get the directory sizse, i wondering if there any better way to find directory size public static double GetDirectorySize(string DirectoryPath) { double...
1
by: Aek | last post by:
What is the best way to recursively change the permissions of the directory we are installing into? Is there a nice way to do this in C# ..NET? We are using an MSI installer and will need to add...
2
by: =?Utf-8?B?ZGdjb29wZXI=?= | last post by:
When I get a list of drives using the Directory.GetLogicalDrives(), it gives me all drives including disconnected network drives. When I attempt to use Directory.GetDirectories() on a disconnected...
2
by: Nathan Sokalski | last post by:
I have an ASP.NET application which displays the directories & files in a specified directory on the server. I use the System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() to...
1
by: sandhyabhavani | last post by:
This article is used to zip a file or directory using vb.net. The classes and method to zip a file is availale in java.io, java.util, java.util.zip class library.To import these you have to add a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.