Generic GDI+ error when saving an image?

0

I want to save in image to other folder but it throw this Exception system.runtime.interopservices.externalexception (0x80040005) this is my code :

pictureBox1.Image.Save(@"" + Application.StartupPath + "\\Image" + "".ToString() + @"\" + @"personeli_" + textBox4.Text + ".jpg");

This program works when I run it in visual studio but when I create setup file with InstallShield it throw an Exception .

c#
exception
installshield
asked on Stack Overflow Dec 12, 2015 by amin

1 Answer

1

I have a same problem and after a long search, I change the folder and my program works .I think if you use this code , your program run . first I create a directory in Cdrive

if (!Directory.Exists((@"C:\Image")))
     Directory.CreateDirectory((@"C:\Image"));

and after that I save picture into it .

 new Bitmap(pictureBox1.Image).Save(@"C:\Image" + @"\" +/* your file name */+ ".jpg");

I hope it works for you ;)

answered on Stack Overflow Dec 13, 2015 by zheek • edited Dec 13, 2015 by zheek

User contributions licensed under CC BY-SA 3.0