C# Save Pitcherbox1 by Button1 in .png
<p>I have been trying to save the image in pictureBox1. What am trying to do is to make it so people can "Save" the image from pictureBox1 by clicking on my "Save As" Button.</p>

<p>I am using Visual Studio 2010 with C#</p>

<p>This is what I have so far:</p>

<pre><code>    private void Button2_Click(System.Object sender, System.EventArgs e)
    {

        SaveFileDialog saveFileDialog1 = new SaveFileDialog();
        saveFileDialog1.Filter = "Png Image|*.jpg";
        saveFileDialog1.Title = "Save an Image File";
        saveFileDialog1.ShowDialog();
        if (saveFileDialog1.FileName != "")
        pictureBox1.Image = new Bitmap ("c:/avatar.png");
        {
            SaveFileDialog dialog = new SaveFileDialog();
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                pictureBox1.Image.Save(@"C:\Documents and Settings\.Png", System.Drawing.Imaging.ImageFormat.Png);
            }
        }
    }
</code></pre>
