FileStream fileStream = new FileStream(@"F:\file11.txt", FileMode.Create);
TextWriter sw = new StreamWriter(@"F:\\file11.txt");int rowcount = dataGridView1.Rows.Count;for (int i = 0; i < rowcount - 1; i++) {sw.WriteLine(dataGridView1.Rows[i].Cells[0].Value.ToString() + "\t" + dataGridView1.Rows[i].Cells[1].Value.ToString() + "\t\t" + dataGridView1.Rows[i].Cells[2].Value.ToString()); } sw.Close();//Don’t Forget Close the TextWriter Object(sw) MessageBox.Show("Data Successfully Exported");