报错不是很明显了(⊙_⊙)?你把文件头的
using  System.Windows.Forms.CommonDialog;删了看看.

解决方案 »

  1.   

    很明显,错误提示你,你类文件的顶上,有个 using System.Windows.Forms.CommonDialog; 语句,有问题 因为 System.Windows.Forms.CommonDialog 这个是一个类,不是命令空间,改一下就好了把  using System.Windows.Forms.CommonDialog; 这一句删除了,如果没有 using System.Windows.Forms; 这个语句,则, 删除 using System.Windows.Forms.CommonDialog; 再加一句 using System.Windows.Forms;
      

  2.   

    我改掉了但是出来了下面的提示:
    找不到类型或命名空间名称“Stream”(是否缺少 using 指令或程序集引用?)
     名称“myStream”在类或命名空间“WindowsApplication1.Form8”中不存在
     找不到类型或命名空间名称“mystream”(是否缺少 using 指令或程序集引用?怎么办啊~~~~~~~~·····
      

  3.   

    using  System.Windows.Forms.CommonDialog; 把这个后面CommonDialog删掉即可
      

  4.   

    谢了,顺便问一下,我设置了一个打开代码,比如说写字板吧,打开以后怎么把打开的内容在我的richtextbox中显示出来啊?
      

  5.   

    StreamReader sr = new StreamReader(path);
    richTextBox.Text = sr.ReadToEnd();
      

  6.   

    请问8楼的专家
    private void menuItem7_Click_1(object sender, System.EventArgs e)

    Stream myStream;
    OpenFileDialog openFileDialog1=new OpenFileDialog ();
    openFileDialog1.InitialDirectory="c:\\";
    openFileDialog1.Filter="All files (*.*)|*.*|文本文件 (*.txt)|*.txt";
    openFileDialog1.FilterIndex=2;
    openFileDialog1.RestoreDirectory=true;
    if(openFileDialog1.ShowDialog() == DialogResult.OK)
    {
    if((myStream=openFileDialog1.OpenFile())!=null)
    {
    myStream.Close();
    }
    }
    string path = this.richTextBox1.Text;
    StreamReader sr = new StreamReader(path); 
    richTextBox1.Text = sr.ReadToEnd();
    }
    程序有什么错误呢?运行可以就是最后出来一个貌似中断的信息。多有叨扰,还请原谅
      

  7.   

      //建立一个打开文件的对话框 
                using (OpenFileDialog dlgText = new OpenFileDialog())
                {
                    dlgText.Filter = @"(*.txt)|*.txt";
                    if (dlgText.ShowDialog() == DialogResult.OK)
                    {
                        if (File.Exists(dlgText.FileName))
                        {
                            label1.Text = "数据文件已加载";
                            this.datafile = dlgText.FileName;
                            this.data = true;
                        }
                    }
                }
      

  8.   

    未处理的“system argumentexception”类型的异常出现在“mscrolib.dll”中。
    其他信息:空路径名是非法的
      

  9.   

    string path = this.richTextBox1.Text; 
    StreamReader sr = new StreamReader(path); richTextBox1.Text为空,StreamReader sr = new StreamReader(path); 会出错