title: How to save files in specific locations without showing SaveDialog's Prompt
body: <p>I'm been wondering is there a way to save a file in specific's folder in C#?</p>
  <p>The only method that I know is 'SaveFileDialog' but the problems is I want to save files</p>
  <p>in folder without showing saveFilesDialog's Box.</p>
  <p><em><strong>saveFilesDialog's Box</strong></em> :  is a box that prompts you to Click 'YES' or 'CANCEL'.</p>
  <p><strong>Code samples</strong></p>
  <p>-In form1</p>
  <pre><code>public Form1()
   {
     InitializeComponent();
   }
  
  private string Path =@&quot;D:\Files&quot;;  //locaction i wanna stores all the files in
  private int i = 0;
  private button1_Click(object sender,EventArgs e) 
  {
      i++;
      SaveDialogFile save = new SaveDialogFile();
      if(Save.
  
      if (save.ShowDialog() != DialogResult.OK)return; //Prompt's Dialog will show
  
  
      save.Filter = &quot;File Text(*.txt)|*.txt&quot;;
      save.InitialDirectory = Path;
      save.FileName = &quot;txt&quot;+i.ToString();
  
      //Goal : i want 'save.FileName' store in 'Path' without Click 'OK' or Show Prompt Dialog's box
  
      
  }
  </code></pre>
  <p><strong>Expect Result</strong>
  [1]: <a href="https://i.stack.imgur.com/9JqWO.png" rel="nofollow noreferrer">https://i.stack.imgur.com/9JqWO.png</a></p>
  <p>Anyone can help me? I kinda stuck rn :)</p>
  <p><strong>This is my full code it's hard to read but you'll get the point</strong></p>
  <pre><code>public partial class convertMp3ToWav : Form
      {
          public convertMp3ToWav()
          {
              InitializeComponent();
          }
          BackgroundWorker bw;
          string withoutEx;
          List&lt;string&gt; song_lists = new List&lt;string&gt;();
  
          private void button1_Click(object sender, EventArgs e)
          {
              bw = new BackgroundWorker();
              bw.DoWork += (obj, ae) =&gt; newThread();
              bw.RunWorkerAsync();
          }
          void newThread()
          {
  
              Thread th = new Thread
              ((ThreadStart)(() =&gt;
              {
                  file();
              }));
              th.SetApartmentState(ApartmentState.STA);
              th.Start();
              th.Join();
          }
          void file()
          {
              
              string path = @&quot;D:\musics\wav&quot;;
              Directory.CreateDirectory(path);
              FolderBrowserDialog f = new FolderBrowserDialog();
              f.ShowDialog();
              string[] lists = Directory.GetFiles(f.SelectedPath, &quot;*.*&quot;, SearchOption.AllDirectories);
              foreach (string list in lists)
              {
                  if (Path.GetExtension(list) == &quot;.mp3&quot;)
                  {
                      string fn = Path.GetFullPath(list);
                      withoutEx = Path.GetFileNameWithoutExtension(fn);
                      song_lists.Add(fn);
                      Console.WriteLine(withoutEx);
  
                      SaveFileDialog save = new SaveFileDialog();
                      save.Filter = &quot;Wav FIle (*.wav)|*.wav;&quot;;
                      //save.FileName = song_lists[0];
                      save.FileName = withoutEx;
                      save.InitialDirectory = path;
  
  
                      if (save.ShowDialog() == DialogResult.OK)
                      {
                          using (Mp3FileReader mp3 = new Mp3FileReader(fn))
                          {
                              using (WaveStream pcm = WaveFormatConversionStream.CreatePcmStream(mp3))
                              {
                                  WaveFileWriter.CreateWaveFile(save.FileName, pcm);
                              }
  
                          }
                      }
                      
                  }
  
              }
             
              
          }
  
       
      }
  </code></pre>
  <p>this code's work pretty well!! but i need to click 'OK' everytime!!
  so is there anyway to save file without click 'OK' everytime!!</p>