Hi i have the following code to export a datagrid view and save it. Now i want that after the user saves the export file it opens. What to do?
private void ExportDGV(DataGridView dgv)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Comma Separated Values (*.csv)|*.csv";
if (sfd.ShowDialog() == DialogResult.OK)
{
TextWriter tw = new StreamWriter(sfd.FileName + ".csv");
for (int i = 0; i < dgv.Rows.Count; i++)
{
for (int j = 0; j < dgv.Columns.Count; j++)
tw.Write(dgv.Rows[i].Cells[j].Value.ToString().Replace(",", "','") + ",");
tw.WriteLine();
}
tw.Close();
}
}