Dim StrExport As String = "" For Each C As DataGridViewColumn In dataGVGeneral.Columns StrExport &= """" & C.HeaderText & """," Next StrExport = StrExport.Substring(0, StrExport.Length - 1) StrExport &= Environment.NewLine For Each R As DataGridViewRow In dataGVGeneral.Rows For Each C As DataGridViewCell In R.Cells If Not C.Value Is Nothing Then StrExport &= """" & C.Value.ToString & """," Else StrExport &= """" & "" & """," End If Next StrExport = StrExport.Substring(0, StrExport.Length - 1) StrExport &= Environment.NewLine Next Dim tw As System.IO.TextWriter = New System.IO.StreamWriter("E:\SAT\Work.io\Work.io\bin\Debug\ListofTasks.csv", False) tw.Write(StrExport) tw.Close()
For Each Row in your datagridview: If the checkbox column value is True Write the other column cells to the csv file End If End For
true
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)