A
Al G
Hi,
I am reading a CSV file with the code below. When I run into a " (quote
mark) in the file, I get a "malformed line" exception.
Can anyone point me to a way to handle this?
Thanks in advance,
Al G
assume Win XP/SP2, VS2005Pro/VB, SP1)
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(filename)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
field1 = currentRow(0)
field2 = currentRow(1)
etc...
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MessageBox.Show("Malformed Line exception")
End Try
End While
End Using
I am reading a CSV file with the code below. When I run into a " (quote
mark) in the file, I get a "malformed line" exception.
Can anyone point me to a way to handle this?
Thanks in advance,
Al G
assume Win XP/SP2, VS2005Pro/VB, SP1)
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(filename)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
field1 = currentRow(0)
field2 = currentRow(1)
etc...
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MessageBox.Show("Malformed Line exception")
End Try
End While
End Using