I have created a winform program in visual studio 2012 that saves a image loaded into a picture box when another button is clicked. I first get the file path from the user with:
PrePath = {FileSave.Text,"RawData",Welcome.File(nextimagecounter)}
Path = IO.**Path**.Combine(PrePath)
Imagea.BackgroundImage.Save(Path)
Where PrePath
is a String Array, Path
is a string, FileSave.Text
is user input in a txt box, Welcome.File(nextimagecounter)
is a string that was stored in array File (found using .GetFiles
) Path = IO.Path.combine(PrePath)
, Imagea.Backgroundimage
is the background image I want to save.
When I do this my program will freeze and I need to go to the task manager to end it. It also throw this error
An unhandled exception of type
'System.Runtime.InteropServices.ExternalException' occurred in
System.Drawing.dll
Additional information: A generic error occurred in GDI+.
Please note I also tried doing the call by:
Imagea.Background.Save(FileSave.Text+"\RawData\"+Welcome.File(nextimagecounter)+".jpg")
This did not work either, another post lead me to Path.Combine
. Any help would be greatly appreciated!