I have a bit of vb.net code that will search for a string, then get a certain amount of characters after it and display in within a text box.
My issue is that is some cases there are more than one string of text I need to display, so rather than just searching for "name" once, how can I loop through the file and display a list of all instances?
This is the code I am using now.
Public Sub readAddress()
Dim sr As StreamReader = New StreamReader(profile + "\Desktop\" + dir + "\" + newfile + ".dat")
Dim data = sr.ReadToEnd()
Dim pos = data.IndexOf("name")
If pos >= 0 Then
ListBox1.Text = data.Substring(pos, 39).Replace("name""", "") + Environment.NewLine
End If
sr.Close()
txt()