FileStream fsInfo = new FileStream("D:/hl.txt", FileMode.OpenOrCreate, FileAccess.Write);
            StreamWriter swInfo = new StreamWriter(fsInfo, Encoding.Unicode);
            swInfo.Flush();
            swInfo.BaseStream.Seek(0, SeekOrigin.Begin);
            foreach (DataGridViewRow row in this.dataGridView1.Rows)
            {
                string str = String.Empty;
                foreach (DataGridViewCell col in row.Cells)
                {
                    str += col.Value + "";
                }
                str += swInfo.NewLine;
                swInfo.Write(str);

            }

            swInfo.Close();

        }
帮忙修改一下,谢谢!!!