别贴图..直接贴代码
|
|
saveFileDialog1.Filter = “文本文件(*.txt)|*.txt”; //保存文件 } |
|
saveFileDialog1.Filter = “文本文件(*.txt)|*.txt”; //保存文件
saveFileDialog1.AddExtension = true; if (textBox1.Text != “”) { saveFileDialog1.ShowDialog(); if (saveFileDialog1.FileName != “”) { FileStream fw1 = new FileStream(saveFileDialog1.FileName, FileMode.Append, FileAccess.Write); StreamWriter fw = new StreamWriter(fw1); for (int i = 0; i <= 55; i = i + 1) { //fw.Write(“B” + “\r\n”); fw.Write(B[i, 0] + “\t”); fw.Write(B[i, 1] + “\t”); fw.Write(B[i, 2] + “\t”); fw.Write(B[i, 3] + “\t”); fw.Write(B[i, 4] + “\t”); fw.Write(B[i, 5] + “\t”); fw.Write(B[i, 6] + “\t”); fw.Write(B[i, 7] + “\t”); fw.Write(B[i, 8] + “\t”); fw.Write(B[i, 9] + “\t”); fw.Write(B[i, 10] + “\r\n”); } 代码如下 |
|
20分 |
程序计算结果跟txt什么关系?
|
20分 |
把数组 添加到它的Sub子项就行了。
|
怎么添加呢。 还望大神详细解答一下。谢谢 |
|
Random rd =new Random (0); for(int i=0;i<55;i++) { for(int j=0;j<11;j++) { B[i, j] = rd.Next(0, 100); } }//随机生成数组,不知道你原来的数组怎么出来的就先随机出来; listView1.Items.Clear(); for (int i = 0; i <= 55; i = i + 1) { ListViewItem lvi = new ListViewItem(); lvi.Text = B[i, 0].ToString(); for (int j = 1; j < 11; j++) { lvi.SubItems.Add(B[i, j].ToString()); } listView1.Items.Add(lvi); }//拖一个ListView进来,直接循环进去,记得listview 改detail 属性 ,添加列 |