FileStream fs
=
new
FileStream(
@"
E:\\1.txt
"
, FileMode.Open, FileAccess.Read);
StreamReader m_streamReader = new StreamReader(fs) ;
// 使用StreamReader类来读取文件
m_streamReader.BaseStream.Seek ( 0 ,SeekOrigin.Begin);
// 从数据流中读取每一行,直到文件的最后一行,并在richTextBox1中显示出内容
this .richTextBox1.Text = "" ;
string strLine = m_streamReader.ReadLine ( ) ;
while ( strLine != null )
{
this .richTextBox1.Text += strLine + " \n " ;
strLine = m_streamReader.ReadLine ( ) ;
}
// 关闭此StreamReader对象
m_streamReader.Close ( ) ;
StreamReader m_streamReader = new StreamReader(fs) ;
// 使用StreamReader类来读取文件
m_streamReader.BaseStream.Seek ( 0 ,SeekOrigin.Begin);
// 从数据流中读取每一行,直到文件的最后一行,并在richTextBox1中显示出内容
this .richTextBox1.Text = "" ;
string strLine = m_streamReader.ReadLine ( ) ;
while ( strLine != null )
{
this .richTextBox1.Text += strLine + " \n " ;
strLine = m_streamReader.ReadLine ( ) ;
}
// 关闭此StreamReader对象
m_streamReader.Close ( ) ;