Here is my code to save image in a folder,but i am getting this error(a generic error occurred in gdi+).
Could someone please help me?

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If (Not System.IO.Directory.Exists("d:/posimage")) Then
            End If
    End sub

try this

            Dim savefile As SaveFileDialog = New SaveFileDialog()
            savefile.DefaultExt = "jpeg"
            savefile.Filter = "All files*.*|*.*"
            If savefile.ShowDialog() = DialogResult.OK Then
                Int(Width = PictureBox1.Width)
                Int(Height = PictureBox1.Height)
                Dim Bitmap As Bitmap = New Bitmap(Width, Height)
                Dim rc As Rectangle = New Rectangle(0, 0, Width, Height)
                PictureBox1.DrawToBitmap(Bitmap, rc)
                Bitmap.Save(savefile.FileName,  System.Drawing.Imaging.ImageFormat.Jpeg)
            End If
        Catch ex As Exception
        End Try

thanks Pgmer.
I have used opendialog tool with a text box(to display path F:/Pictures/Tree.jpg) and a button(Open Folder)to open an image, and when i click on Submit button the image should move to a folder in D drive (D:/Image) and the new location(D:/Image/Tree.jpg) should be stored in database.Please help

Then instead of using SaveFileDialog u can hard code the path u want to save and u need write a method or function whcih saves the pic into database. Use image datatype to save into DB

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.