//保存表项到txt文件---------------------------- private void menuItem5_Click(object sender, EventArgs e) { //string file = this.saveFileDialog1.FileName; string file = "aa.txt"; FileInfo fi = new FileInfo(file); StreamWriter sw = fi.CreateText(); sw.WriteLine("名称\t单价"); for (int i = 0; i < this.listView1.Items.Count; i++) { sw.WriteLine("{0}\t{1}", listView1.Items[i].Text, listView1.Items[i].SubItems[1].Text); } sw.Close(); MessageBox.Show("数据保存成功!", "恭喜你:"); }初次接触c#以上是我写的把istView控件的数据保存到txt文件,如何按照原格式读入到istView?谢谢!
- 2 回答
- 0 关注
- 459 浏览
添加回答
举报
0/150
提交
取消