Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim path As String = FolderBrowserDialog1.SelectedPath Dim di As New DirectoryInfo(path) Dim yourSearchString As String yourSearchString = "my string" For Each Dir As String In Directory.GetDirectories(FolderBrowserDialog1.SelectedPath) ListBox1.Items.Clear() ListBox2.Items.Add(Dir) Next For Each fi As FileInfo In di.GetFiles() If File.ReadAllText(fi.FullName).Contains(yourSearchString) Then Console.WriteLine(fi.Name) ListBox1.Items.Add(fi.Name) End If Next End Sub
Directory.GetFiles(FolderBrowserDialog1.SelectedPath, "*.*", SearchOption.AllDirectories)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)