点击按钮,直接弹出txt文本文件,不需要在另一个窗体显示,这样有办法吗?

解决方案 »

  1.   

    你要弹出什么呢?文件内容?还是记事本程序呢?
    StreamReader hc = new StreamReader(@"C:\database.txt");
                string ss = hc.ReadToEnd();
                MessageBox.Show(ss);
      

  2.   

    private void button2_Click(object sender, EventArgs e)
    {
        System.Diagnostics.Process.Start("notepad.exe", "c:\\a.txt");
    }
      

  3.   

    1\  System.Diagnostics.Process.Start("notepad.exe", @"路径+文件名"); 
    2\   MessageBox.Show(System.IO.File.ReadAllText(@"路径+文件名"));
      

  4.   

    System.Diagnostics.Process.Start("notepad", txtFile); 
      

  5.   

    Process.Start("c:\\cc.txt");
    直接这样就可以了