hi
First post here, im currently developing a little application which needs to export the data from my datagridview to a csv file. So far I have:
Dim gridData(DataGridView1.Rows.Count - 1) As String
For Each r As DataGridViewRow In DataGridView1.Rows
If r.IsNewRow Then Exit For
Dim cellValues(DataGridView1.Rows(r.Index).Cells.Count - 1) As String
For Each c As DataGridViewCell In DataGridView1.Rows(r.Index).Cells
cellValues(c.ColumnIndex) = c.Value.ToString
Next
gridData(r.Index) = String.Join(",", cellValues)
Next
Dim lines = From line In gridData _
Where line <> Nothing _
Select line
IO.File.WriteAllLines("C:\temp\file.csv", lines.ToArray)
This so far writes to the file but has no column headings. Any ideas?