標題:
listbox如何filter檔案?
[打印本頁]
作者:
herhsiu
時間:
2010-7-28 22:57
標題:
listbox如何filter檔案?
使用listbox來顯示某目錄下的檔案,目錄下檔名有 .filename 跟 filename,沒有附檔名,該如何把.filename濾除只顯示filename?
作者:
Hsieh
時間:
2010-7-29 00:08
回復
1#
herhsiu
fs = Dir("D:\*")
Do Until fs = ""
ListBox1.AddItem Left(fs, InStr(fs, ".") - 1)
fs = Dir
Loop
複製代碼
作者:
kimbal
時間:
2010-7-29 00:14
回復
1#
herhsiu
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim fld
Dim fil
Set fld = fso.GetFolder("C:\Temp")
For Each fil In fld.Files
List1.AddItem Left(fil.Name, Len(fil.Name) - InStr(1, StrReverse(fil.Name), "."))
Next
Set fil = Nothing
Set fld = Nothing
Set fso = Nothing
複製代碼
作者:
GBKEE
時間:
2010-7-29 16:21
回復
1#
herhsiu
Sub Ex()
Dim Fs, Fi
Set Fs = CreateObject("Scripting.FileSystemObject")
For Each Fi In Fs.GetFolder("D:\Test").Files
List1.AddItem Fs.GetBaseName(Fi)
Next
Set Fs = Nothing
End Sub
複製代碼
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)