Searched many site, and there is no such a function in Visual Basic, so have to create by my own.
Visual Basic is very simple and easy language to catch up for new programmer. Below is the function, which you need input the search text, and file name (it’s full name with the path), Optional parameter ignorecase default value is false. If it’s true, then it will take a little bit longer to compare.
You can easily to change to search in binary file as well. But I think most case is search a string in a text file.
Private Function searchTextInFile(text As String, Filename As String, Optional ignoreCase As Boolean = False) As Boolean
Dim readText As String = File.ReadAllText(Filename)
If ignoreCase Then
readText = readText.ToLower
text = text.ToLower
Do’t forget to put imports into your code header.