//判断文本文件行数方法
///
///
StreamReader FileStreamTemp = new StreamReader(path);
while ((FileStreamTemp.ReadLine()) != null){Length++;}FileStreamTemp.Close();
return Length;}//逐行读取方法
private void ReadTXTLineByLine(){string path = "";
System.IO.StreamReader file = new System.IO.StreamReader(path);//创建文件流,path为文本文件路径
int counter = 0;
string line = "";
string output = "";
int lineLength = lineIndex(path);
MessageBox.Show("第" + counter.ToString() + "行读取成功,内容:\n" + output);}if (_i == (lineLength - 1)){MessageBox.Show("文本已读取完毕");}}}