title: C# save txt file on desktop
body: <p>How can I save a txt file that it was created by me on desktop?</p>
  
  <p>This is the code:</p>
  
  <pre><code>void CreaTxtBtnClick(object sender, EventArgs e){
      string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
      filePath = filePath + @"\Error Log\";
      TextWriter sw = new StreamWriter(@"Gara.txt");
  
      int rowcount = dataGridView1.Rows.Count;
      for(int i = 0; i &lt; rowcount - 1; i++){
          sw.WriteLine(
              dataGridView1.Rows[i].Cells[0].Value.ToString() + '\t' +
              dataGridView1.Rows[i].Cells[1].Value.ToString() + '\t' +
              dataGridView1.Rows[i].Cells[2].Value.ToString() + '\t' +
              dataGridView1.Rows[i].Cells[3].Value.ToString() + '\t' +
              dataGridView1.Rows[i].Cells[4].Value.ToString() + '\t' +
              dataGridView1.Rows[i].Cells[5].Value.ToString() + '\t' +
              dataGridView1.Rows[i].Cells[6].Value.ToString() + '\t' +
              dataGridView1.Rows[i].Cells[7].Value.ToString() + '\t'
          );
      }
      sw.Close();
      MessageBox.Show("File txt creato correttamente");
  }
  </code></pre>
  
  <p>I thought that with these instructions</p>
  
  <pre><code>Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
  filePath = filePath + @"\Error Log\";
  TextWriter sw = new StreamWriter(@"Gara.txt");
  </code></pre>
  
  <p>I can save the file on Desktop, but the txt is created correctly in the wrong path.
  How can I fix it?</p>