Grabbing Line within a Text File
Posted on 2006-11-05
I had a similar question like this before and thought I had it working but I cant.
I have a text file, that I'll read and I want to display all the lines below a particular line heading. For instance, if I type inside a texbox "Firmware3" is want it to grad all the lines below it and "Firmware4". And if I type in "Firmware4" I want all the lines between it and "Firmware8".
- Resolves issue with setup wizard
- Updated wireless security tab
- Adds SecureEasySetup push button support
- Resolves large file transfer issues
- Supports version 2 hardware
I've tried several ways but here's my latest. Please help.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sr As New IO.StreamReader("c:\test.txt")
Dim linein As String
Dim Result As Integer
linein = sr.ReadLine
Do Until linein Is Nothing
Result = InStr(linein, "Firmware3")
If Result <> -1 Then
TextBox1.Text = (linein)
linein = sr.ReadLine()