日期:2014-05-19  浏览次数:20899 次

看这段代码怎么结束呢?高手们啊你们都去吃中餐了吗?
这是一个打开文本的代码,但是最后我不晓得怎么来显示在textbox1里面。。指点一下吧。。。就是打“?”那里


private   void   btnBrowser_Click(object   sender,   EventArgs   e)
                {
                        OpenFileDialog   fdlg   =   new   OpenFileDialog   ();
                        fdlg.Title   =   "打开 ";
                        fdlg.InitialDirectory   =   "d:\\ ";
                        fdlg   .Filter   =   "all   files   (*.*)|*.* ";
                        if(fdlg.ShowDialog()   ==   DialogResult.OK)
                        {
                                textBox1.Text   =   ??????;
                        }
                }
        }
}

------解决方案--------------------
if(fdlg.ShowDialog() == DialogResult.OK)
{
System.IO.FileInfo f = new System.IO.FileInfo(fdlg.FileName);
System.IO.StreamReader sr = f.OpenText();
textBox1.Text = sr.ReadToEnd();
}