title: How to save a PictureBox image in varying formats?
body: <p>I have a picture box that will contain an image generated during run-time. I need to save this image using a SaveFileDialog, for which I have found the fallowing code:</p>
  
  <pre><code> private void saveFileDialog1_FileOk(object sender, CancelEventArgs e)
      {
          pictureBox.Image.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
      }
  </code></pre>
  
  <p>This works however, I need to allow the user to specify in the FileDalog what format they want it to be saved as.
  The allowed formats for the user:</p>
  
  <p>Bitmap (*.bmp), </p>
  
  <p>GIF (*.gif),</p>
  
  <p>JPEG (*.jpg),</p>
  
  <p>and  PNG (*.png).
  Any examples or recommendations on how to accomplish this would be much appreciated. </p>