Click here to Skip to main content
15,892,674 members
Home / Discussions / C#
   

C#

 
GeneralRe: Enums, Intellisense, and switchs… Pin
harold aptroot5-Mar-10 11:55
harold aptroot5-Mar-10 11:55 
GeneralRe: Enums, Intellisense, and switchs… Pin
Dan Mos5-Mar-10 11:56
Dan Mos5-Mar-10 11:56 
GeneralRe: Enums, Intellisense, and switchs… Pin
Matthew Klein5-Mar-10 11:56
Matthew Klein5-Mar-10 11:56 
GeneralRe: Enums, Intellisense, and switchs… Pin
BryanWilkins5-Mar-10 11:58
professionalBryanWilkins5-Mar-10 11:58 
AnswerRe: Enums, Intellisense, and switchs… Pin
RCoate5-Mar-10 15:54
RCoate5-Mar-10 15:54 
AnswerRe: Enums, Intellisense, and switchs… Pin
#realJSOP6-Mar-10 1:06
mve#realJSOP6-Mar-10 1:06 
QuestionGDI Related issue - External Exception being thrown in System.Drawing.dll Pin
Eagle325-Mar-10 10:19
Eagle325-Mar-10 10:19 
Answercommon problem, standard answer Pin
Luc Pattyn5-Mar-10 10:27
sitebuilderLuc Pattyn5-Mar-10 10:27 
Most, if not all, errors inside GDI+ are reported as "generic problem occurred in GDI+". If the affected line is an Image.Save chances are your path is incorrect or inaccessible, your disk is full, or your destination file exists and is locked.

If you load an image from a file, most of the time the file remains locked as long as the Image is alive. This would prevent you from saving an image to the same path.

It applies to Image.FromFile, and probably also to PictureBox.ImageLocation
The one exception I am aware of is when you use Image.FromStream.

So I suggest one of these two workarounds:
Bitmap bm=null;
{
    Bitmap bm1=Image.FromFile(filepath);
    bm=new Bitmap(bm1);
    bm1.Dispose();
}
// bm is OK now, and bm1 is disposed of and out of scope, the file isn’t locked.

or
Bitmap bm=null;
using (FileStream stream=File.OpenRead("image.jpeg")) {
    bm=Image.FromStream(stream);
}


Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.

GeneralRe: common problem, standard answer Pin
Giorgi Dalakishvili6-Mar-10 2:51
mentorGiorgi Dalakishvili6-Mar-10 2:51 
GeneralRe: common problem, standard answer Pin
Luc Pattyn6-Mar-10 5:04
sitebuilderLuc Pattyn6-Mar-10 5:04 
AnswerRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
BryanWilkins5-Mar-10 10:28
professionalBryanWilkins5-Mar-10 10:28 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
Eagle325-Mar-10 11:21
Eagle325-Mar-10 11:21 
AnswerRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
BryanWilkins5-Mar-10 11:40
professionalBryanWilkins5-Mar-10 11:40 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
Eagle325-Mar-10 12:19
Eagle325-Mar-10 12:19 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
Luc Pattyn5-Mar-10 11:48
sitebuilderLuc Pattyn5-Mar-10 11:48 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
BryanWilkins5-Mar-10 11:51
professionalBryanWilkins5-Mar-10 11:51 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll [modified] Pin
Eagle325-Mar-10 12:35
Eagle325-Mar-10 12:35 
AnswerRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
Luc Pattyn5-Mar-10 13:35
sitebuilderLuc Pattyn5-Mar-10 13:35 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
Eagle326-Mar-10 0:04
Eagle326-Mar-10 0:04 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
BryanWilkins6-Mar-10 3:55
professionalBryanWilkins6-Mar-10 3:55 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
Eagle3210-Mar-10 11:28
Eagle3210-Mar-10 11:28 
GeneralRe: GDI Related issue - External Exception being thrown in System.Drawing.dll Pin
BryanWilkins10-Mar-10 11:32
professionalBryanWilkins10-Mar-10 11:32 
QuestionDynamic Form Pin
eddieangel5-Mar-10 9:21
eddieangel5-Mar-10 9:21 
AnswerRe: Dynamic Form Pin
BryanWilkins5-Mar-10 9:58
professionalBryanWilkins5-Mar-10 9:58 
AnswerRe: Dynamic Form Pin
MollyTheCoder5-Mar-10 10:11
MollyTheCoder5-Mar-10 10:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.