string address = PictureBox.Location;
give the location of Picturebox image source.
How get address of Picturebox's image source in this order:
C:\\ABC\\XYX\\image.png
The PictureBox load with:
using (MySqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
using (MemoryStream stream = new MemoryStream())
{
if (dr["IMAGE"] != DBNull.Value)
{
byte[] image = (byte[])dr["IMAGE"];
stream.Write(image, 0, image.Length);
Bitmap bitmap = new Bitmap(stream);
pictureBox.Image = bitmap;
}
}
}
}
I did try this one and doesn't help.
string strFileName = PictureBox.ImageLocation + @"\ImageOne.JPG";
Also tried this:
pictureBox.Image.Save("D:\\ImageOne.JPG", ImageFormat.Jpeg);
Gives me this error:
A generic error occurred in GDI+. at System.Drawing.Image.Save
Thanks.