Click here to Skip to main content
15,891,427 members
Home / Discussions / C#
   

C#

 
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 
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 
Hi,

Thanks for the advice.

I have checked the amount of space on my HDD and i have 255 GB free. I am trying to save the images back to a folder which is located in "Pictures" folder.

I tried to make a copy of the image but it still throws an exception. My write method writes the title to the global image after i have created the image.

I am using Filestream as advised. I have wrapped the whole block of code when using the "using" directive.

I also dispose the global image after i have made a copy of it. I used the clone method and then use the cloned image to be saved. But i still get the same error message.

Any thoughts?

Here is a segment of the code:

else if(txtBoxOut.Text != "")
{

   string destFolder = txtBoxOut.text
   foreach(string filePath in filePaths)
   {
     using(FileStream fileStream = File.OpenRead(filePath))
    { 
       this.bmp = Image.FromStream(fileStream);
       string fileName = Path.GetFileName(filePath);
      
     try 
     {

       //write the title to the global image by using a custom write method
       //create a clone
        Image newImage = (Image)this.bmp.Clone();
        this.bmp.Dispose();
       //check folder
       if(destFolder.EndsWith("\\")
       {
        //use the inbuilt save method
        this.newImage.Save(destFolder+fileName+ImageFormat.Jpeg);
       }
       else
       {
        this.newImage.Save(destFolder+"\\"+fileName+ImageFormat.Jpeg);
        
       }

      }
      catch(Exception e)
      {

        Console.WriteLine(e.message.ToString());
      }
    }

   }
 }

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 
QuestionHow to: Launch an application and embed it into a dockable window? Pin
Shmulik285-Mar-10 9:06
Shmulik285-Mar-10 9:06 
AnswerRe: How to: Launch an application and embed it into a dockable window? Pin
DaveyM695-Mar-10 9:16
professionalDaveyM695-Mar-10 9:16 
GeneralRe: How to: Launch an application and embed it into a dockable window? Pin
Giorgi Dalakishvili6-Mar-10 2:49
mentorGiorgi Dalakishvili6-Mar-10 2:49 
QuestionDisable DataGridViewTextBoxCell Right Click Menu Pin
potatoe915-Mar-10 8:49
potatoe915-Mar-10 8:49 

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.