Wednesday, June 17, 2009

Read in a tab delimited file in vb.net

If its a comma delimited file you can change ControlChars.Tab to ","
        Dim fields As String()
        Dim delimiter As String = ControlChars.Tab
        Using parser As New TextFieldParser(MultipleInputFile)
          parser.SetDelimiters(delimiter)
          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: