Private Sub Command1_Click()
Dim fs As FileSystemObject
Dim f As Folder
Dim folders As folders
Dim i As Long
Dim old As Long
Dim cur As Long
Set fs = New FileSystemObject
old = 0
lstResult.AddItem "C:\"
lstResultAll.AddItem "C:\"
cur = lstResult.ListCount While cur > old
While cur > old
Set f = fs.GetFolder(lstResultAll.List(old))
Set folders = f.SubFolders
For Each f In folders
lstResult.AddItem f.Name
lstResultAll.AddItem (f.Path) & "\"
Next
old = old + 1
Wend
cur = lstResultAll.ListCount
Wend
End Sub 试试这个代码。需要再添加一个名为lstResultAll的ListBox
Dim fs As FileSystemObject
Dim f As Folder
Dim folders As folders
Dim i As Long
Dim old As Long
Dim cur As Long
Set fs = New FileSystemObject
old = 0
lstResult.AddItem "C:\"
lstResultAll.AddItem "C:\"
cur = lstResult.ListCount While cur > old
While cur > old
Set f = fs.GetFolder(lstResultAll.List(old))
Set folders = f.SubFolders
For Each f In folders
lstResult.AddItem f.Name
lstResultAll.AddItem (f.Path) & "\"
Next
old = old + 1
Wend
cur = lstResultAll.ListCount
Wend
End Sub 试试这个代码。需要再添加一个名为lstResultAll的ListBox
解决方案 »
- 支持VB2008的Orcle驱动器是哪个?
- VB6.0 客户端程序如何获取服务器端的时间?
- 请问如何在vb中实现.net中的时间控件
- DATAGrid问题,送分的哦
- ORACLE里的系统表TABS??为什么可以得到数据集,但是rs.fields(0)的时候拿不到数据??
- 【问】如何让SHBrowseForFolder在!!!Win98!!!下实现预先选定文件夹?
- 如何修改一个目录的属性?
- ADO连接带密码的数据库时出现的错误!!!
- E2492 Properties may only be assigned using a simple statement, e.g. \"prop = value;\"
- 怎样做数据排序?或者是执行一条SQL语句?
- 如何在vb中控制纸张的边界(200分求解)
- vb安装问题
sub listfolder(fd as folder)
dim sfd as folder
for each sfd in fd.subfolders
treeview.nodes.add fd.path,tvwchild,sfd.path,sfd.name
listfolder sfd
next
end sub
treeview.nodes,add ,,fd.path,fd.path
listfolder fd