第1个回答 2011-09-09
你这样做:
1.应用命名空间:using System.IO
2.在按钮button1中的点击事件中添加如此代码:
this.openFileDialog1.ShowDialog();
string filePath = this.openFileDialog1.FileName;
StreamReader sReader = new StreamReader(filePath, Encoding.Default);
this.richTextBox1.Text = sReader.ReadToEnd();
sReader.Dispose();
这样应该就可以了。本回答被提问者采纳