Использовал два компонента от vb6 dirlist и filelist
| Код | Imports VB = Microsoft.VisualBasic Dim CDir1 As Object = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox Dim CFile1 As Object = New Microsoft.VisualBasic.Compatibility.VB6.FileListBox Dim FFile() as String ReDim FFile(0) Sub FindFiles(ByVal sPattern As String, ByVal CurrDir As String, ByRef sFound() As String) try Dim i As Short Dim sCurrPath As String Dim ii As Short Dim iLen As Short If VB.Right(CurrDir, 1) <> "\" Then CDir1.Path = CurrDir & "\" Else CDir1.Path = CurrDir End If For i = 0 To CDir1.DirListCount If CDir1.DirList(i) <> "" Then System.Windows.Forms.Application.DoEvents() Call DirWalk(sPattern, CDir1.DirList(i), sFound) Else If VB.Right(CDir1.Path, 1) = "\" Then sCurrPath = VB.Left(CDir1.Path, Len(CDir1.Path) - 1) Else sCurrPath = CDir1.Path End If CFile1.Path = sCurrPath CFile1.Pattern = sPattern If CFile1.Items.Count > 0 Then ' нужные файлы найдены в каталоге For ii = 0 To CFile1.Items.Count - 1 ReDim Preserve sFound(UBound(sFound) + 1) sFound(UBound(sFound) - 1) = sCurrPath & "\" & CFile1.Items(ii) Next ii End If iLen = Len(CDir1.Path) Do While Mid(CDir1.Path, iLen, 1) <> "\" iLen = iLen - 1 Loop CDir1.Path = Mid(CDir1.Path, 1, iLen) End If Next i Catch End Try End Sub FindFiles("*.txt", "C:/", FFile)
|
Я помоему где-то когдато это нашел... непомню точно, но этот конкретный пример я нашел в одном из старых проектов с vb6. |