Hello, I'm working on a software project that must read 'log' files and parse each line. Right now I'm just doing a proof of concept type thing, and trying to read two lines of a text file with "," as delimiters.
Here's what I have so far:
And say I'm trying to read a file with this in it:
Can,You,Read
THIS,Sentence?
I choose the file to read, it only comes up with the first line. I have a feeling I can do something with line number, but the code I tried didn't work right.
Thanks.
Here's what I have so far:
PHP:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "" Then
Dim LogFile As String = OpenFileDialog1.FileName
ListBox1.Items.Clear()
Dim Parser As Microsoft.VisualBasic.FileIO.TextFieldParser
Parser = My.Computer.FileSystem.OpenTextFieldParser(LogFile)
Parser.SetDelimiters(",")
Dim textfields As String() = Parser.ReadFields()
For Each currentfield As String In textfields
ListBox1.Items.Add(currentfield)
Next
Parser.Close()
End If
And say I'm trying to read a file with this in it:
Can,You,Read
THIS,Sentence?
I choose the file to read, it only comes up with the first line. I have a feeling I can do something with line number, but the code I tried didn't work right.
Thanks.