请问怎么去取文件夹中的所有文件名?
C盘下aaa文件夹中的所有文件名该怎么取? --------------------编程问答-------------------- Dim f As Stringf = Dir("c:\aaa\")
Do While Len(f) > 0
Debug.Print f
f = Dir
Loop --------------------编程问答--------------------
Dim TempStr As String
Private Sub Command1_Click()
TempStr = Dir$("C:\aaa\")
Do While TempStr <> ""
List1.AddItem TempStr '假设读取到List
TempStr = Dir$
Loop
End Sub
添加listbox commandbutton 控件
--------------------编程问答-------------------- Private Sub Form_Load()
Dim f As String
f = Dir("c:\aaa\", vbArchive + vbHidden + vbReadOnly + vbSystem + vbNormal)
Do While Len(f) > 0
Debug.Print f
f = Dir
Loop
End Sub
--------------------编程问答-------------------- '在窗体Form1中添加一个驱动器列表框Drive1、目录列表框Dir1、文件列表框File1
'演示在文件列表框中得到aaa文件夹下所有文件
Option Explicit
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Form_Load()
Dim aaa As String
aaa = "C:\Windows"
Dir1.Path = aaa
File1.Pattern = "*.*" '在文件列表框中得到aaa文件夹下的所有文件
End Sub --------------------编程问答-------------------- http://blog.csdn.net/chenhui530/archive/2007/10/03/1810299.aspx
补充:VB , 基础类