LocationTextFieldParser.FieldWidths SyntaxDim fileParser As FileIO.TextFieldParser ' ...later... Dim result As Integer( ) = fileParser.FieldWidths or: fileParser.FieldWidths = setOfWidths
DescriptionThe FieldWidths property sets or retrieves the number of characters used for each field in fixed-width text-file parsing. The first field begins with the first character on each record line, and subsequent fields immediately follow the fields before. You can indicate that the last field is of variable length (that is, it includes all characters until the end of the line) by setting the last field width to -1. You can also set the field widths with the TextFieldParser object's SetFieldWidths method. Usage at a Glance
ExampleThe following example uses the FieldWidths property to indicate that each line in the input file contains three fields: a 3-character field, a 30-character field, and a 5-character field. Dim scanInput As Microsoft.VisualBasic.FileIO.TextFieldParser ' ...later... scanInput.TextFieldType = _ Microsoft.VisualBasic.FileIO.FieldType.FixedWidth scanInput.FieldWidths = New Integer( ) {3, 30, 5} Related Framework Entries
See AlsoDelimiters Property, ReadFields Method, SetDelimiters Method, SetFieldWidths Method, TextFieldParser Object, TextFieldType Property |