I have a directoryInfo named Folder with a name property of "A:\". I'm then
trying to loop through and expand it a level.
But when I say:
For Each myFolder in Folder.GetDirectories...
A series of dialog boxes are displayed saying the drive is empty (it is) and
an exception is thrown "drive is empty". The dialog boxes appear before I
get control in the catch Statement.
This happens for empty CD drivs too.
How can I test for this without getting an exception and all of those dialog
boxes?
Thanks,
Gary
"G Dean Blake" <gb@nospam.com> schrieb:
> For Each myFolder in Folder.GetDirectories...
>
[quoted text clipped - 6 lines]
> How can I test for this without getting an exception and all of those
> dialog boxes?
Untested:
<URL:http://www.google.de/groups?selm=%23lgX6tpBEHA.3804%40TK2MSFTNGP09.phx.gbl>

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
G Dean Blake - 29 Apr 2005 01:12 GMT
That gets rid of the error dialogs but I still get an exception.
Thanks,
G
> "G Dean Blake" <gb@nospam.com> schrieb:
>> For Each myFolder in Folder.GetDirectories...
[quoted text clipped - 11 lines]
>
> <URL:http://www.google.de/groups?selm=%23lgX6tpBEHA.3804%40TK2MSFTNGP09.phx.gbl>
Herfried K. Wagner [MVP] - 29 Apr 2005 23:08 GMT
"G Dean Blake" <gb@nospam.com> schrieb:
> That gets rid of the error dialogs but I still get an exception.
You may want to put the line in a 'Try...Catch' block.

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>