i just encounterd an error gdi+ when saving same image back to database.

im using this code to get image from db
Code:
            'Stream object containing the binary data
            Dim ms As MemoryStream
            ms = New MemoryStream(CType(Me.DataGridSearchView.SelectedCells(10).Value, Byte()))
            frm.Picture1 = Image.FromStream(ms)
            ms.Close()
frm.Picture1 is a property of image type from another class.

and this my code to update image back to db
Code:
If Not Me.PictureBox1.Image Is Nothing Then
                    Dim custPic as Byte() = Nothing
                    Dim ms As MemoryStream = New MemoryStream
                    Me.PictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
                    custPic = ms.GetBuffer
                    ms.Close()
                End If
there is no problem if i changed the image before saving it back to db,it gives error if you will not change the image before saving it back to database..

anyone have an idea..please share..

thank you very much in advance..
glen.a