I need to export everything that contains a DataGridView to txt files (each row a file) but in the case that a cell of a given column has the same value, those two rows must be exported in a single file.
At the moment I export the files that are selected
TextWriter tw = new StreamWriter(path, true);
for (int i = 0; i < TablaDatos.Rows.Count; i++)
{
if (Convert.ToBoolean(TablaDatos.Rows[i].Cells[Exportar.Name].Value) == true)
{
foreach (DataGridViewCell cell in TablaDatos.Rows[i].Cells)
{
data += (cell.Value + "\t");
}
data += "\n";
}
}
tw.WriteLine(data, "data");
tw.Close();
MessageBox.Show("Datos exportados correctamente");
I need to export all the Grid that is one file per row, but, if they have the same category, export each row within a same txt file, if in the whole Grid there is only one file with category 8 for example, that row will be a txt file.