By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,088 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

show next line of list in textbox2

P: 2
I would like textbox2 to display the next line after I search the textbox.
Can someone advise ?
Expand|Select|Wrap|Line Numbers
  1.   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  2.         Using reader As New StreamReader(pathto)
  3.             While Not reader.EndOfStream
  4.                 Dim line As String = reader.ReadLine()
  5.  
  6.                 If line.Contains("SearchString") Then
  7.                     TextBox1.Text = line
  8.  
  9.                     TextBox2.Text = "I want the next line to appear here"
  10.  
  11.                     Exit While
  12.                 End If
  13.             End While
  14.         End Using
  15.     End Sub
Nov 24 '13 #1
Share this Question
Share on Google+
3 Replies


Frinavale
Expert Mod 5K+
P: 9,731
What is the "Next Line"?
Where is the "Next Line" located?
What does searching have to do with the "Next Line"?

-Frinny
Dec 2 '13 #2

P: 2
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
Dec 2 '13 #3

Frinavale
Expert Mod 5K+
P: 9,731
Set a flag that indicates that you found the line.
If you have found the line loop one more time (if possible)


-Frinny
Dec 2 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.