Find all lines with a specific word in .txt file and put them in textbox

Hello, I have been using

TextBox1.Text = File.ReadAllLines("MyText.txt").FirstOrDefault(Function(x) x.Contains("user")) 

or this

Using reader As New StreamReader("Test.txt") While Not reader.EndOfStream Dim line As String = reader.ReadLine() If line.Contains("user") Then TextBox1.Text = line Exit While End If End While End Using 

to find the first instance of the word “user” and placing it in textbox1. Now I need to make it so it will put all the lines with the word “user” in textbox1 since I now need to see all the users not just the first user in the text file. Can anyone guide me on modifying the code to put all the lines that contain the word “user” in textbox1?

submitted by /u/lapintana
[link] [comments]

Leave a Reply