C#:Saving image to folder
        Posted  
        
            by Meko
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Meko
        
        
        
        Published on 2010-06-02T11:43:28Z
        Indexed on 
            2010/06/02
            11:53 UTC
        
        
        Read the original article
        Hit count: 216
        
HI. I know this is simple question but when I use
 FirstPersonTestImage.Save(IIdComboBox.Text + "-" + i + ".jpg");
it works and saves file to folder where is the .exe file . But I want to save it to specific folder like /photo/IO-66/ and tryed to use
 String StudentPath = PhotoPath + IGroupNoComboBox.Text + "/" + IIdComboBox.Text + "/" + IIdComboBox.Text + "-" + i + ".jpg";
 FirstPersonTestImage.Save(StudentPath);
BUt it gives
An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll
How can I solve this problem? Is is about folder path ? or using "/" ?
EDIT
Here My code for creating and checking existing or not folder
  if (!System.IO.Directory.Exists(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()))
            {
               Directory.CreateDirectory(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim());
            }
             if (!System.IO.Directory.Exists(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()+ "/" + IIdComboBox.Text.ToString().Trim() + "/"))
            {
                Directory.CreateDirectory(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()+"/" + IIdComboBox.Text.ToString().Trim() + "/");
            }
© Stack Overflow or respective owner