HasFieldsEnclosedInQuotes Property


HasFieldsEnclosedInQuotes Property

Location

TextFieldParser.HasFieldsEnclosedInQuotes

Syntax

     Dim fileParser As FileIO.TextFieldParser     ' ...later...     Dim result As Boolean = fileParser.HasFieldsEnclosedInQuotes 

or:

     Dim fileParser As FileIO.TextFieldParser     ' ...later... fileParser.HasFieldsEnclosedInQuotes = hasQuotes 


hasQuotes (required; Boolean)

Indicates whether the delimited strings in the file represented by fileParser are surrounded by quotation marks (true) or not (False).

Description

The HasFieldsEnclosedInQuotes property gets or sets a value that indicates whether the delimited fields parsed by a TextFieldParser object should accept quotation marks as field boundaries (true) or not (False). If you do not specifically set this field, it defaults to true.

If this property is set to true and a field is enclosed by quotes, any active delimiters (such as commas) found between the quotation marks are considered part of the field and are not used to delimit portions of that field. For instance, if comma is used as a delimiter, in the input line:

     field1,field2,"field3,field4",field5 

there are only four fields represented, since "field3,field4" is a single field containing a comma.

Usage at a Glance

  • The HasFieldsEnclosedInQuotes property is only useful with delimited input files, not fixed-width files.

  • You must close the TextFieldParser object when finished with it. Use the object's Close method or create the object instance with the Using keyword. See the TextFieldParser Object entry in this chapter for an example.

Related Framework Entries

  • Microsoft.VisualBasic.FileIO.TextFieldParser.HasFieldsEnclosedInQuotes Property

See Also

Delimiters Property, ReadFields Method, SetDelimiters Method, TextFieldParser Object, TextFieldType Property, TrimWhiteSpace Property




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net