Самый простой способ сделать это, чтобы прочитать текстовый файл в одну строку, а затем использовать рамки .NET, чтобы найти спичку:
Dim text As String = File.ReadAllText("D:\Temp\MyFile.txt")
Dim index As Integer = text.IndexOf("hello")
If index >= 0 Then
' String is in file, starting at character "index"
End If
или раствор 2 Вам нужно StreamReader и Regx для этого.
//read file content in StreamReader
StreamReadertxt Reader = new StreamReader(fName);
szReadAll = txtReader.ReadToEnd();//Reads the whole text file to the end
txtReader.Close(); //Closes the text file after it is fully read.
txtReader = null;
//search word in file content
if (Regex.IsMatch(szReadAll, "SearchME", RegexOptions.IgnoreCase))//If the match is found in allRead
MessageBox.Show("found");
else
MessageBox.Show("not found");
Все, я надеюсь, что это разрешит ваши запросы. С уважением
пройти через это [учебник] (http://www.codeproject.com/Questions/302262/How-to-search-specific-string-into- text-file-from) и дайте мне знать, если это поможет. –