TextFieldParser.TextFieldType Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Indicates whether the file to be parsed is delimited or fixed-width.
public:
property Microsoft::VisualBasic::FileIO::FieldType TextFieldType { Microsoft::VisualBasic::FileIO::FieldType get(); void set(Microsoft::VisualBasic::FileIO::FieldType value); };
public Microsoft.VisualBasic.FileIO.FieldType TextFieldType { get; set; }
member this.TextFieldType : Microsoft.VisualBasic.FileIO.FieldType with get, set
Public Property TextFieldType As FieldType
Property Value
A TextFieldType value that indicates whether the file to be parsed is delimited or fixed-width.
Examples
This example creates a TextFieldParser
, FileReader
, and specifies that it is delimited.
Using FileReader As New Microsoft.VisualBasic.FileIO.
TextFieldParser("C:\ParserText.txt")
FileReader.TextFieldType =
Microsoft.VisualBasic.FileIO.FieldType.Delimited
FileReader.SetDelimiters(",")
End Using
This example creates a TextFieldParser
, FileReader
, and specifies that it is fixed-width.
Using FileReader As New Microsoft.VisualBasic.FileIO.
TextFieldParser("C:\ParserText.txt")
FileReader.TextFieldType =
Microsoft.VisualBasic.FileIO.FieldType.FixedWidth
FileReader.FieldWidths = New Integer() {5, 10, 11, -1}
End Using
Remarks
The default value of this property is delimited.
The following table lists examples of tasks involving the TextFieldType
property.
To | See |
---|---|
Read from a delimited text file | How to: Read From Comma-Delimited Text Files |
Read from a fixed-width text file | How to: Read From Fixed-width Text Files |
Read from a text file with multiple formats | How to: Read From Text Files with Multiple Formats |
Applies to
See also
- OpenTextFieldParser(String)
- FieldType
- Objects (Visual Basic)
- Parsing Text Files with the TextFieldParser Object
- How to: Read From a Comma-Delimited Text File in Visual Basic
- How to: Read From a Fixed-width Text File in Visual Basic
- How to: Read From a Text File with Multiple Formats in Visual Basic
- Troubleshooting Exceptions: Microsoft.VisualBasic.FileIO.TextFieldParser.MalformedLineException