读取文本,不能全部读出来?
private void button2_Click(object sender, EventArgs e){
string filePath = "";
OpenFileDialog opd = new OpenFileDialog();
if (opd.ShowDialog() == DialogResult.OK)
{
filePath = opd.FileName;
}
StreamReader sr = new StreamReader(filePath,Encoding.Default);
string s = sr.ReadLine();
while (sr.ReadLine()!=null)
{
textBox1.Text+=s + "\r\n";
s = sr.ReadLine();
}
}创建一个10行的文本,为什么只能读出来奇数行?无法全部读出来,怎么解决?
https://www.h5w3.com/29056.html参考下 参考下这个链接https://www.h5w3.com/29056.html 可以参考:https://www.fons.com.cn/70990.html https://www.h5w3.com/29056.html参考下这篇文章
页:
[1]