What I'm trying to do is take a source file and only pull specific lines out and display those lines to a label/textbox/etc. What's happening is I am able to pull the first line, however my loop is terminating and I do not receive the rest of the results. Here is what the source will look like:
text1 = text1
text2 = text2
text3 = text3
text4 = text4
text5 = abcdefg (Yes)
text6 = hijklmn (Yes)
text7 = 1234567 (No)
text8 = abcdefg (No)
What I want to pull is any data that is marked Yes, so in this case abcdefg and hijklmn.
Here is the coding I have so far:
Dim stream_reader As New StreamReader("c:\sample.txt") Dim file_contents As String = stream_reader.ReadToEnd() Dim count As Integer stream_reader.Close() count = file_contents.IndexOf("(Yes)") file_contents = file_contents.Replace(vbLf, "") file_contents = file_contents.Substring(count) Label4.Text = file_contents
From here, it will only return almost what I'm looking for, however it's just not it. Any help would be appreciated. Thank you!
Edited 4 Years Ago by kjk86: typo