Hello Group,
I'm bemused as to why this code isn't working. It's a
very simple loop over the array of FileInfo objects
returned from DirectoryInfo.GetFiles. It works fine until
the eigth iteration at which point it blows up, everytime.
Sample Code:
...
Imports System.IO
...
Dim fInfo, fsInfo() As FileInfo
Dim dirInfo = New DirectoryInfo ("c:\")
fsInfo = dirInfo.GetFiles
For Each fInfo in fsInfo
Console.WriteLine fInfo.Name
Next
...
It collapses saying 'The handle is invalid'. Looking at
things in the debugger only leads to more confusion since
I can see 14, apparently valid, FileInfo objects in fsInfo.
Changing to a different directory, in fact, changing anything
makes no difference. It's always the eigth time.
What the heck?
Dominic