I am trying to create a program that will search a text file for a line of text and then return the full line of information. 

Example line: Joe Blogs JBL 1234 

Search: Joe Blogs

Search returns: Joe Blogs JBL 1234 

To make it as simple as possible, I have 2 text boxes & 1 button. 

Textbox1 = search 

Textbox2 = Search results 

Button = Search button 

Can anyone tell me how to do this because I'm finding it really difficult. I'm new to VB coding so the simplest of code would be helpful! 

This is what I have so far: 

```
Imports System.IO

Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    ' Input Text Error 

    If TextBox1.TextLength = 0 Then
        MsgBox("Please enter a Staff Name or Staff Code", MsgBoxStyle.Information, "Error")
    End If

    'Perform Search

    Dim strText As String = SearchFile("F:\Documents\Documents\Visual Studio 2015\Projects\ExtentionLocator\ExtentionLocator\Extentionlist.txt", TextBox1.Text)
    If strText <> String.Empty Then
        TextBox2.Text = strText
    End If

End Sub

'Search Function

Public Shared Function SearchFile(ByVal strFilePath As String, ByVal strSearchTerm As String) As String
    Dim sr As StreamReader = New StreamReader(strFilePath)
    Dim strLine As String = String.Empty

    Try
        Do While sr.Peek() >= 0
            strLine = String.Empty
            strLine = sr.ReadLine
            If strLine.Contains(strSearchTerm) Then
                sr.Close()
                Exit Do
            End If
        Loop

        Return strLine
    Catch ex As Exception
        Return String.Empty
    End Try
End Function

'Clear Button

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    TextBox2.Text = ""
    TextBox1.Text = ""
End Sub

' Open The text file 

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    Process.Start("C:\Users\kylesnelling\Documents\Visual Studio 2015\Projects\ExtentionLocator\ExtentionLocator\Extentionlist.txt")
End Sub

End Class

```

Whenever I perform a search, all I get back is the last line of the text file... does anyone know why?