直接上代码
//新建一个储存的list List<string> listLines = new List<string>(); StreamReader sr = new StreamReader("E:\test.txt", Encoding.Default); String line; while ((line = sr.ReadLine()) != null) { //打印到控制台 //Console.WriteLine(line.ToString()); listLines.Add(line); } for (int i = 0; i < listLines.Count; i++) { //打印到控制台 //Console.WriteLine(listLines[i].ToString()+" "); //填入textbox中 textBoxX1.AppendText(listLines[i].ToString()+" "); }