细菌rtpcr内参:c#为何网上高手写的程序都不能出结果?

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 20:11:47
看了一段读取文件的代码
FileStream fs = new FileStream ( "C:\\file.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 ( ) ;
我想试着运行它,添加了一个按钮button1,就把它放在
private void button1_Click ( object sender , System.EventArgs e )
{
}
中了,也注意了加入名字空间
奇怪的是,运行不报错,无警告,但是点了button1就是不能读出结果,郁闷到极点

高手请指教,是那段代码有问题呢,还是我哪里做的不对?

如果是应用程序看看 窗体设计器代码里面有没有下面的代码
this.button1 = new System.Windows.Forms.Button();
如果是WEB程序 看有没有:
this.button1.Click+=.......

不妨在button事件中加入调试信息看看到底事件有没有被触发。可能事件根本没有注册到button控件上去。