//方法一
string[] strR = File.ReadAllLines("D:\\MyFile4.txt");//获取整个文本内容
//int iRow = strR.Length;//获取txt文件的行数
for (int iRow = 0; iRow < strR.Length; iRow++)
{
textBox1.Text += strR[iRow] + "\r\n";
}
//方法二
StreamReader sr1 = new StreamReader("D:\\MyFile4.txt");
while (sr1.Peek() >= 0)
{
string str1 = sr1.ReadLine();
textBox1.Text += str1+"\r\n";
}
string[] strR = File.ReadAllLines("D:\\MyFile4.txt");//获取整个文本内容
//int iRow = strR.Length;//获取txt文件的行数
for (int iRow = 0; iRow < strR.Length; iRow++)
{
textBox1.Text += strR[iRow] + "\r\n";
}
//方法二
StreamReader sr1 = new StreamReader("D:\\MyFile4.txt");
while (sr1.Peek() >= 0)
{
string str1 = sr1.ReadLine();
textBox1.Text += str1+"\r\n";
}