Şu şekilde çözüm buldum.
Kod:
Sub KlasorleriListele()
Dim satir As Integer
Dim sarkiBaslangic, klasorBaslangic, sarkiAdiUzunlugu As Integer
Dim sarkiAdi, klasorAdi As String
Dim FilesInDir As String() = Directory.GetFiles(Application.StartupPath & "\REPERTUARX\", "*.txt", SearchOption.AllDirectories)
Dim SFile As String
ListView1.Items.Clear()
For Each SFile In FilesInDir
sarkiBaslangic = SFile.LastIndexOf("\") + 2
sarkiAdi = Mid(SFile, sarkiBaslangic)
sarkiAdiUzunlugu = Len(SFile) - sarkiBaslangic + 2
klasorBaslangic = SFile.IndexOf("X\") + 3
klasorAdi = Mid(SFile, klasorBaslangic, (Len(SFile) - sarkiAdiUzunlugu + 1) - klasorBaslangic)
ListView1.Items.Add(klasorAdi)
ListView1.Items(satir).SubItems.Add(sarkiAdi)
satir += 1
Next
End Sub
Sub Ara()
Dim satir As Integer
Dim sarkiAdi, klasorAdi As String
Dim sarkiBaslangic, klasorBaslangic, sarkiAdiUzunlugu As Integer
Dim ara As String = "*" & TextBox1.Text.Trim() & "*.txt"
Dim FilesInDir As String() = Directory.GetFiles(Path.Combine(Application.StartupPath, "REPERTUARX"), ara, SearchOption.AllDirectories)
Dim SFile As String
ListView1.Items.Clear()
For Each SFile In FilesInDir
sarkiBaslangic = SFile.LastIndexOf("\") + 2
sarkiAdi = Mid(SFile, sarkiBaslangic)
sarkiAdiUzunlugu = Len(SFile) - sarkiBaslangic + 2
klasorBaslangic = SFile.IndexOf("X\") + 3
klasorAdi = Mid(SFile, klasorBaslangic, (Len(SFile) - sarkiAdiUzunlugu + 1) - klasorBaslangic)
ListView1.Items.Add(klasorAdi)
ListView1.Items(satir).SubItems.Add(sarkiAdi)
satir += 1
Next
End Sub
Private Sub DRm_TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
RichTextBox1.Text = ""
Ara()
End Sub
drummers, 11-05-2009 tarihinden beri AccessTr.neT üyesidir.
Cevapla