Troubleshooting Exceptions: Microsoft.VisualBasic.FileIO.TextFieldParser.MalformedLineException 

A MalformedLineException exception is thrown when a TextFieldParser cannot parse a row using the specified format.

The Error Line property of the exception object contains the text of the line causing the error.

Associated Tips

  • Check to ensure the TextFieldType and Delimiter parameters are defined properly
    The TextFieldType (delimited or fixed-width) must match the format of the file. If the TextFieldType is FixedWidth, check that the FieldWidths property has been set correctly. If the TextFieldType is Delimited, check that the Delimiters property has been set correctly.

See Also

Tasks

How to: Read From Comma-Delimited Text Files in Visual Basic
How to: Read From Fixed-width Text Files in Visual Basic

Reference

MalformedLineException

Concepts

Parsing Text Files with the TextFieldParser Object