Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. private void SaveFile_Click(object sender, EventArgs e)
  2. {
  3. string fileCSV = "";
  4. for (int i = 0; i < dataGridView1.RowCount - 1; i++)
  5. {
  6. for (int j = 0; j < dataGridView1.ColumnCount; j++)
  7. {
  8. fileCSV += (dataGridView1[j, i].Value).ToString() + ";";
  9. }
  10. fileCSV += "\t\n";
  11. }
  12. StreamWriter wr = new StreamWriter("test.csv", false, Encoding.GetEncoding("windows-1251"));
  13. wr.Write(fileCSV);
  14. wr.Close();
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement