天天看點

winform,C#,打開檔案對話框的使用

{//打開檔案對話框

    this.openFileDialog1.Filter="*.txt|*.txt|所有檔案(*.*)|*.*";

    if(this.openFileDialog1.ShowDialog()==DialogResult.OK)

    {

     try

     {

      string Name=this.openFileDialog1.FileName;  

      richTextBox1.LoadFile(Name,RichTextBoxStreamType.PlainText);

      this.statusBarPanel1.Text=Name;

     }

     catch(Exception){}

    }

轉載于:https://www.cnblogs.com/hfzsjz/archive/2010/02/21/1670699.html

c#