Results 1 to 10 of 10

Thread: Saving a picture without manually choosing the location?

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2011
    Posts
    67

    Re: Saving a picture without manually choosing the location?

    I can do the file name, I am unsure how to add the location in?

    I have
    Quick save Code:
    1. quicksave.FileName = "screenshot" & intCount + 1
    2.  
    3.         PictureBox1.Image.Save(quicksave.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)

    and I want it to save to "C:\Users\Karl\Desktop\Screenshot"?

  2. #2
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Re: Saving a picture without manually choosing the location?

    What is this quicksave.filename and intCount +1 all about? As i previously said you need to hard code the location. When i say hard code write the string value exactly as how you would see it.

    For example if you wanted to save the picture from multiple instances in your application with possibly a different location each time you can make a new method as such.

    vb Code:
    1. Private Sub SavePictureBox(ByVal path As String)
    2.         PictureBox1.Image.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg)
    3. End Sub

    Now when calling this method you would pass an argument.

    vb Code:
    1. SavePictureBox("C:\Users\Karl\Desktop\Screenshot\filename.jpeg")


    vb Code:
    1. PictureBox1.Image.Save("C:\Users\Karl\Desktop\Screenshot\filename.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2011
    Posts
    67

    Re: Saving a picture without manually choosing the location?

    Ahh thank you, I misunderstood the first time, it is working now.

    The intCount is the number of files in that folder, so by adding 1 to it, it should be a unique filename.
    I did it like this to include the intCount
    vb Code:
    1. PictureBox1.Image.Save("C:\Users\Karl\Desktop\Screenshot\" & quicksave.FileName & ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width