I wrote a program that works just fine when run from within Visual Studio 2012. However, when I compile and run a release version, I get the following:
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at EinsteinRiddle.frmMain.buildImage(Int32& fRow, Int32& rNum, String& strCmd, Int32& itms) in C:\Users\Gerry\Documents\Visual Studio 2012\Projects\Learning and Testing\EinsteinRiddle\EinsteinRiddle\frmMain.vb:line 848
at EinsteinRiddle.frmMain.btSolve_Click(Object sender, EventArgs e) in C:\Users\Gerry\Documents\Visual Studio 2012\Projects\Learning and Testing\EinsteinRiddle\EinsteinRiddle\frmMain.vb:line 281
The line referenced, frmMain.vb: line 848 is the following:
[line 847] Dim fName As String = <stuff> + ".jpg"
[line 848] bmp.Save(fName, ImageFormat.Jpeg)
Note that the above is inside a Using bmp As New Bitmap(imgHorSize, imgVerSize)
.
I have no idea why this is happening. Can you help?