具体要领如下:
private void importTxtNoAdd() { string line; string sFileName = ""; if (openFileDialog1.ShowDialog() == DialogResult.OK) { sFileName = openFileDialog1.FileName; dtTemp.Rows.Clear(); iXH = 0; System.IO.StreamReader file = new System.IO.StreamReader(sFileName); while ((line = file.ReadLine()) != null) { // if(line.Length==11 ) DataRow dr = dtTemp.NewRow(); dr[0] = iXH + 1; dr[1] = "姑且用户"; dr[2] = line; dtTemp.Rows.Add(dr); iXH++; } file.Close(); System.Console.ReadLine(); //bindGrid(""); } }
但愿本文所述对大家C#措施设计的学习有所辅佐。
除声明外,,跑步客文章均为原创,转载请以链接形式标明本文地点
本文地点: