i want to make a save button for images without having to open a save file dialog so i would specify the name and location to save in the code
please help

Recommended Answers

All 5 Replies

'assign your image here
        Dim img As Image
        'name of your image file
        Dim Name As String = "MyImage.jpeg"
        'specify full path where you want to save your file
        Dim fileNameWithPath As String = "C:\Documents and Settings\navjyot.nishant\Desktop\" & Name
        'saving the image.
        img.Save(fileNameWithPath, System.Drawing.Imaging.ImageFormat.Jpeg)

Happy Coding:-)

'assign your image here
        Dim img As Image
        'name of your image file
        Dim Name As String = "MyImage.jpeg"
        'specify full path where you want to save your file
        Dim fileNameWithPath As String = "C:\Documents and Settings\navjyot.nishant\Desktop\" & Name
        'saving the image.
        img.Save(fileNameWithPath, System.Drawing.Imaging.ImageFormat.Jpeg)

Happy Coding:-)

thanks alot this worked exactly right i just changed your code a little:

Dim Name As String = TextBox2.Text + ".png"
        Dim fileNameWithPath As String = "C:\Program Files\Screencap2.0\" + TextBox1.Text + "\" + Name
        PictureBox1.Image.Save(fileNameWithPath, System.Drawing.Imaging.ImageFormat.Png)

P.S. im making a screen capturer so this on a timer and it saves as a bunch of pictures.

how to use image in in a buttion in form

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.