show next line of list in textbox2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TamPepper
    New Member
    • Nov 2013
    • 2

    show next line of list in textbox2

    I would like textbox2 to display the next line after I search the textbox.
    Can someone advise ?
    Code:
      Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Using reader As New StreamReader(pathto)
                While Not reader.EndOfStream
                    Dim line As String = reader.ReadLine()
    
                    If line.Contains("SearchString") Then
                        TextBox1.Text = line
    
                        TextBox2.Text = "I want the next line to appear here"
    
                        Exit While
                    End If
                End While
            End Using
        End Sub
    Last edited by Frinavale; Dec 2 '13, 03:39 PM. Reason: Added code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    What is the "Next Line"?
    Where is the "Next Line" located?
    What does searching have to do with the "Next Line"?

    -Frinny

    Comment

    • TamPepper
      New Member
      • Nov 2013
      • 2

      #3
      I enter a sting to be searched for in a text file
      After finding the line I entered, It is displayed in TextBox1.
      I want whatever line comes next in the text file, displayed in textbox2
      Say there are 4 lines in the text file
      Line One
      Line Two
      Line Three
      Line Four
      and I search for "Line Two", it is displayed in texbox1 but I want "Line Three" to be displayed in textbox2

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Set a flag that indicates that you found the line.
        If you have found the line loop one more time (if possible)


        -Frinny

        Comment

        Working...