title: opening an already existing txt file on button click in c# windows form
body: <p>My requirement is that when i click a button (C# windows form) of my application,an already existing txt file should get opened in notepad.</p>
  
  <p>I have already tried the above code : </p>
  
  <pre><code>private void btn1_Click(object sender, EventArgs e)
      {
          Process p = new Process();
          String str = txt1.Text;
          ProcessStartInfo ps = new ProcessStartInfo("C:\\Users\\gaurav_joshi\\My Documents\\test.txt");
          ps.UseShellExecute = false;
          ps.RedirectStandardInput = true;
  
          p.StartInfo = ps;
          p.Start();
  
          p.StandardInput.Write("This is a test.");
          p.StandardInput.Flush();
          p.StandardInput.Close();
      }
  </code></pre>
  
  <p>But when i run the program an exception is occuring as follows
  Win32 Exception 
  "The specified executable is not a valid application for this OS platform"</p>
  
  <p>With streamReader i can read the file but i want to launch the notepad or wordpad itself to read that particular existing file.</p>
  
  <p>Can somebody help me with the above problem</p>