Thursday, March 12, 2009

Read a comma delimited file in VB.NET

the snippets is

The code is below:
Dim filename As String = FILE_NAME
Dim fields As String()
Dim delimiter As String = ","
Using parser As New TextFieldParser(filename)
While Not parser.EndOfData
' Read in the fields for the current line
fields = parser.ReadFields()
' Add code here to use data in fields variable.
End While
End Using

No comments: