2011-01-05 127 views

回答

5
Imports System.IO 

Dim fInfo As FileInfo()     
Dim i As Integer = 0   
Dim path AS String = "INSERT FILE PATH"  
Dim dInfo As New DirectoryInfo = New DirectoryInfo(path) 

fInfo = dInfo.GetFiles("*.txt")    
Dim files As String()     
Dim File As String     
files = Directory.GetFiles(path, "*.txt")     
For Each File In files       
    'Do Something With The File     
    i += 1     
Next 
+0

FileInfo()和DirectoryInfo發送錯誤,說他們是未定義的。目錄說它沒有聲明=/ – Voldemort 2011-01-05 18:55:42

+0

對不起,我的意思是Visual Basic .NET? – Voldemort 2011-01-05 19:00:06

+0

將「Imports System.IO」添加到代碼文件的頂部 – 2011-01-05 19:04:07