با این کد می تونید تمام فایل های متنی رو باز کنی و درونش جستجوکنی
foreach (string strfolder in System.IO.Directory.GetFiles(Environment.CurrentDirectory+"آدرس فولدر"))
{
string fName = strfolder; //path to text file
StreamReader testTxt = new StreamReader(fName);
string allRead = testTxt.ReadToEnd();//Reads the whole text file to the end
testTxt.Close();//Closes the text file after it is fully read.
string regMatch = textBox3.Text; //string to search for inside of text file. It is case sensitive.
if (Regex.IsMatch(allRead, regMatch) & textBox3.Text != "")//If the match is found in allRead
{
listBox1.Items.Add(strfolder);
}