You can use this code
to save datagrid into text file:
code snippet:
StreamWriter
sw = new StreamWriter("hello.txt");
foreach(DataGridItem dg in datagrid1.Items)
{
string
str = string.Empty;
for
(int i = 0; i < dg.Cells.Count; i++)
{
str += dg.Cells[i].Text + " ";
}
sw.WriteLine(str);
}
sw.Close();