当我尝试阅读阿拉伯格式的文件时,我只看到最后一行……有什么问题吗?
代码:
// Read the file and display it line by line in text box
System.IO.StreamReader file =
new System.IO.StreamReader("arabic.txt", Encoding.UTF8);
while ((line = file.ReadLine()) != null)
{
txtfile[count] = line;
textBox1.Text = txtfile[count]+Environment.NewLine;
count++;
}
file.Close();发布于 2011-12-11 19:02:21
试试textBox1.Text += txtfile[count]+Environment.NewLine;
发布于 2011-12-11 19:02:47
之所以只看到TextBox中的最后一行,是因为您没有附加文本。
尝试使用
textBox1.Text += txtfile[count]+Environment.NewLine;而不是
textBox1.Text = txtfile[count]+Environment.NewLine;发布于 2011-12-11 19:04:40
你可以试一下,
TextBox1.Text=System.IO.File.ReadAllText("arabic.txt",Encoding.UTF8);https://stackoverflow.com/questions/8463434
复制相似问题