DataGridViewExtensionsExportToCSV Method
Exports the source DataGridView to CSV table format.
Namespace: DevCase.Extensions.DataGridViewExtensionsAssembly: 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 string ExportToCSV(
this DataGridView sender,
string defaultValueIfEmpty = ""
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function ExportToCSV (
sender As DataGridView,
Optional defaultValueIfEmpty As String = ""
) As String
Dim sender As DataGridView
Dim defaultValueIfEmpty As String
Dim returnValue As String
returnValue = sender.ExportToCSV(defaultValueIfEmpty)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static String^ ExportToCSV(
DataGridView^ sender,
String^ defaultValueIfEmpty = L""
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member ExportToCSV :
sender : DataGridView *
?defaultValueIfEmpty : string
(* Defaults:
let _defaultValueIfEmpty = defaultArg defaultValueIfEmpty ""
*)
-> string
No code example is currently available or this language may not be supported.
- sender DataGridView
-
The source DataGridView.
- defaultValueIfEmpty String (Optional)
-
A default value to write in a CSV field
if the corresponding DataGridViewCell value is .
String
The resulting
CSV table string.
In Visual Basic and C#, you can call this method as an instance method on any object of type
DataGridView. 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 dt As New DataTable()
With dt
dt.Columns.Add("Name", GetType(String))
dt.Columns.Add("Date", GetType(Date))
dt.Rows.Add("Elektro", Date.Parse("01-01-2016"))
End With
DataGridView1.DataSource = dt
Dim csv As String = DataGridView1.ExportToCSV("N/A")
Console.WriteLine(csv)
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.