2010年6月3日 星期四

載入某一個目錄下的檔案

'動態載入XML檔案
Dim mydir As String
mydir = My.Application.Info.DirectoryPath

'只顯示XML檔案
Dim TheDir As New DirectoryInfo(mydir)
Dim arrFiles() As FileInfo

arrFiles = TheDir.GetFiles
For Each arrfile As FileInfo In arrFiles
'If InStr(arrfile.ToString, ".xml", CompareMethod.Text) > 0 And InStr(arrfile.ToString, "WindowsA", CompareMethod.Text) = 0 Then

If InStr(arrfile.ToString, ".xml", CompareMethod.Text) > 0 And InStr(Mid(arrfile.ToString, 1, 1), "I", CompareMethod.Text) > 0 Then
'If InStr(arrfile.ToString, ".xml", CompareMethod.Text) > 0 Then CLBxmllist.Items.Add(arrfile.ToString) '取得 欄位值!
End If

Next

沒有留言:

張貼留言

追蹤者