|
-
May 17th, 2002, 03:27 PM
#1
Thread Starter
Addicted Member
Getting used to IEnumerator's
I'm trying to write a search routine that will search the hard drive for a list of files to see if they exist, I keep getting this error:
An unhandled exception of type 'System.ArgumentException' occurred in search.exe
Additional information: The parameter is incorrect.
it crashes on this line:
oFolder = oFS.GetFolder(oFolders(FolderKey.Current).Path.ToString)
it also crashes on the msgbox line that is commented out, and I just don't see why.
Public Function File_Search_Test( ByVal rs As ADODB.Recordset) As String
Dim oFS As New Scripting.FileSystemObject()
Dim oFolder As Scripting.Folder
Dim oFolders As Scripting.Folders
Dim oDrives As Scripting.Drives
Dim oDrive As Scripting.Drive
Dim iCount As Short
Dim iFolder As Short
Dim oKey As IEnumerator
Dim FolderKey As IEnumerator
oDrives = oFS.Drives
oKey = oDrives.GetEnumerator
Do Until oKey.MoveNext = False
If oDrives(oKey.Current).DriveType.ToString = "Fixed" Then
oFolders = oDrives(oKey.Current).RootFolder.SubFolders
FolderKey = oFolders.GetEnumerator
FolderKey.MoveNext()
'MsgBox(oFolders.Item(FolderKey.Current).Name.ToString)
oFolder = oFS.GetFolder(oFolders(FolderKey.Current).Path.ToString)
MsgBox(oFolder.Name)
End If
-Daryl
"Two More Rolls of Duct tape, and the world is mine!"
VB.NET Guru
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|