TextFieldParserExtensionsToDataTable Method
Converts the source TextFieldParser to DataTable.
Namespace: DevCase.Extensions.TextFieldParserExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static DataTable ToDataTable(
this TextFieldParser sender,
bool useFirstRowAsColumns
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function ToDataTable (
sender As TextFieldParser,
useFirstRowAsColumns As Boolean
) As DataTable
Dim sender As TextFieldParser
Dim useFirstRowAsColumns As Boolean
Dim returnValue As DataTable
returnValue = sender.ToDataTable(useFirstRowAsColumns)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static DataTable^ ToDataTable(
TextFieldParser^ sender,
bool useFirstRowAsColumns
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member ToDataTable :
sender : TextFieldParser *
useFirstRowAsColumns : bool -> DataTable
No code example is currently available or this language may not be supported.
- sender TextFieldParser
-
The source TextFieldParser.
- useFirstRowAsColumns Boolean
-
If set to , use the items of the first row of
the source TextFieldParser to create the columns of
the resulting DataTable.
DataTable
The resulting
DataTable.
In Visual Basic and C#, you can call this method as an instance method on any object of type
TextFieldParser. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This is a code example.
No code example is currently available or this language may not be supported.
Dim csvTable As New DataTable()
Dim csvText As String =
Name; Last Name; Age
Michael; Johnson Phillips; 26
William; Lee Williams; 34
Susan; Parker Evans; 32
Matilda; Garcia Martinez; 28
.Value
Using csvReader As New StringReader(csvText),
csvParser As New TextFieldParser(csvReader) With {
.Delimiters = {";"c},
.HasFieldsEnclosedInQuotes = False,
.TextFieldType = FieldType.Delimited
}
csvTable = TextFieldParserExtensions.ToDataTable(csvParser, useFirstRowAsColumns:=True)
End Using
Me.DataGridView1.DataSource = csvTable
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.