|
-
Mar 14th, 2000, 09:13 PM
#1
Thread Starter
Lively Member
Hello VB gurus. Hope you are well.
Spot the deliberate mistake...
Code:
Private Sub ShowFolders(ByVal DirName As String)
Dim fso As New FileSystemObject, fld As Folder, flds As Folders
Dim fo As Folder
Set fo = fso.GetFolder(DirName)
Set flds = fo.SubFolders
For Each fld In flds
tvTreeView.Nodes.Add DirName, tvwChild, fld.Name, fld.Name
Next
Set fo = Nothing
Set flds = Nothing
End Sub
Whenever I run this, I get "Runtime error '13' - Type Mismatch" at "Set fo = fso.GetFolder(DirName)". DirName is (example) "E:\". This is an EXACT word-for-word copy from another application that works, just this one doesn't. Can anyone tell me why? I'm going rapidly mad.
Thank you very much
T
Some cause happiness wherever they go; others, whenever they go.
-
Mar 14th, 2000, 11:02 PM
#2
Using your code and passing the DirName, it worked just fine. Here is how I used it:
ShowFolders "C:\"
The only error I've got was a TreeView error, since I didn't
have any parents in the TreeView, so this line:
tvTreeView.Nodes.Add DirName, tvwChild, fld.Name, fld.Name
was failing because I didn't have any parent node to add a child to. But that's another issue.
Edited by Serge on 03-15-2000 at 11:03 AM
-
Mar 14th, 2000, 11:28 PM
#3
Thread Starter
Lively Member
Ah well. Thanks anyway Serge.
T
Some cause happiness wherever they go; others, whenever they go.
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
|