Click here to Skip to main content
15,793,624 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
readonly ImageConverter _imgConvertor = new ImageConverter();
oleDbCommand.Parameters.AddWithValue("@MojavezImage", ((byte[])_imgConvertor.ConvertTo(picMojavezImage.Image, typeof(byte[]))));

exception : A generic error occurred in GDI+.
Why this error occurs?
[no name] 23-Sep-13 5:00am    
What you are trying to do..??

Share this answer
Instead of using ImageConverter, try this:
byte[] data;
using (MemoryStream ms = new MemoryStream())
    myImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
    data = ms.ToArray();
Share this answer
ahmadamiri 23-Sep-13 5:30am    
Again the same error....
OriginalGriff 23-Sep-13 5:45am    
Then the first thing you need to look at is: do you have a good image in your PictureBox? Is it displaying ok?
ahmadamiri 23-Sep-13 6:02am    
yes it displaying ok
OriginalGriff 23-Sep-13 6:13am    
Do you get the error on the myImage.Save line?
ahmadamiri 23-Sep-13 6:30am    
yes get the error on the myImage.Save line
This code has been used in the past without error
Error does not occur when the picturebox is null
when image bind on picturebox error occur

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900