Skip to content

PictureBox1.Image.Save() using C#

vinod

Asked Oct 23, 2008, 2:38 AM EDT5 answers
Share
LinkedInX
Hi,
Please say anyone how to use
PictureBox.Image.Save() Using C#

My requirement is to save the image which is in picture to Application Folder ... I mean the image is to be saved to the folder which is in the solution folder(Application.StartUpPath.. like that)  and the path should be hotcoded...
 

5 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • +1
    Code
    if the picture is loaded in the picture box and you want to store it in solution folder,  hope the following couple of lines can help you
    string filename = Application.StartupPath + "\\myImage.jpg";
    pictureBox1.Image.Save(filename);
    +1
  • +1
    Thanks for ur help... it's working .
    But it is saving the image ....\bin\Debug\"MyImageFolder";

    now i added a folder to my project(where we can see all the forms and forms.cs in Solution Explorer ). there in that folder can i save or place my image instead of saving the image at .....\bin\Debug\".." ?
    +1
  • +1

    I think u can't access ur project folder(where forms, forms.cs are stored) during runtime or after deployment.
    It is accessible only during compile time.

    SO you can access only the debug folder during runtime.

    +1
  • +1

     The main problem is

    I created an xml in my application by MyWindowsApplication -> Add New Item -> XML File  and created data in that. ok it's fine. But when ever iam trying to  Load(XmlDocument.Laod)  that XML using Application.StratUpPath it is going to ....\bin\Debug\... instead of getting MyXML which i have creaed recently. and it showing file not found error....

    Am i clear in explaining  my dought.. if not again i will expalin it clearly ..

    +1
  • +1

    Yes, Application.StartUpPath will go to debug folder only. usually we don't use the solution folder in runtime environment because of security issues.

    if the XML files serves configuration information, you better include a configuration file.

    if you are using xml file for some other purpose you have to give the location of the file. even though you are storing it in the solution folder (Project Name -> add new item -> XML file )  you need to give the full path.

    +1