我读取指定txt的内容,读到textbox控件和richtextbox控件里,内容不一样是什么原因?
求大神指导
代码如下:
private void button1_Click(object sender, EventArgs e)
{
byte[] byt = new byte[1024];
UTF8Encoding utf8 = new UTF8Encoding(true);
string str = "";
using (FileStream fs = File.Open(textBox1.Text, FileMode.Open))
{
while (fs.Read(byt, 0, byt.Length) > 0)
{
str = str + utf8.GetString(byt);
}
}
textBox2.Text = str;
richTextBox1.Text = str;
}
出现的问题如图

调结果试:

求大家帮帮忙
求大神指导
代码如下:
private void button1_Click(object sender, EventArgs e)
{
byte[] byt = new byte[1024];
UTF8Encoding utf8 = new UTF8Encoding(true);
string str = "";
using (FileStream fs = File.Open(textBox1.Text, FileMode.Open))
{
while (fs.Read(byt, 0, byt.Length) > 0)
{
str = str + utf8.GetString(byt);
}
}
textBox2.Text = str;
richTextBox1.Text = str;
}
出现的问题如图

调结果试:

求大家帮帮忙
