I am making a Garfield comic viewer in C#. I have a button that saves the comic on screen to the computer. However, when I compile it from Visual C# Express, it saves perfectly. When I run the exe file from the directory, I get an unhandled exception message stating "A generic error occurred in GDI+". Here is my saving code:
private void save_Click(object sender, EventArgs e)
{
using (SaveFileDialog sfdlg = new SaveFileDialog())
{
sfdlg.Title = "Save Dialog";
sfdlg.Filter = "Bitmap Images (*.bmp)|*.bmp|All files(*.*)|*.*";
if (sfdlg.ShowDialog(this) == DialogResult.OK)
{
using (Bitmap bmp = new Bitmap(pictureBox1.Image.Width, pictureBox1.Image.Height))
{
pictureBox1.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
pictureBox1.Image = new Bitmap(pictureBox1.Image.Width, pictureBox1.Image.Height);
pictureBox1.Image.Save("c://cc.Jpg");
bmp.Save(sfdlg.FileName);
pictureBox1.ImageLocation = "http://garfield.com/uploads/strips" + "/" + whole.ToString("yyyy-MM-dd") + ".jpg";
MessageBox.Show("Comic Saved.");
}
}
}
}
What can I do?