private void ReadTxtFile(string ttStr, int n)
{
String line = “”;
int i = 0;
string[] strSplit = new string[] { “\t”, " " };
try
{
string s=null;
StreamReader sr = new StreamReader(“文本路径”, Encoding.Default);
if (sr.EndOfStream == false) line = sr.ReadLine();
while (sr.EndOfStream == false)
{
if ((line = sr.ReadLine()) != "")
{
s=line;//循环读取txt文本数据,也可将变量s变成动态数组,将读取内容惊醒存储
}
}
}
}
sr.Close();
}
catch (Exception err)
{ MessageBox.Show(err.Message, "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information); }