3
Answers

Picture Box not displaying the image loaded from access db.

vijay raj

vijay raj

11y
1.5k
1
hello guys, i have windows form in which i load the data searching by name. In first attempt it shows the selected data with image. But, when i search with new name, text and numbers are getting displayed but image remains the same old one loaded before. This is my code

To load picture in picturebox
pictureBox1.Image = ByteArrayToImage1((Byte[])dt.Rows[0]["pic"]);

Converts byte array to image
Bitmap ByteArrayToImage1(byte[] b)
        {

            MemoryStream ms = new MemoryStream();
            byte[] pData = b;
            ms.Write(pData, 0, Convert.ToInt32(pData.Length));
            Bitmap bm = new Bitmap(ms, false);
            ms.Dispose();
            return bm;
 
        }
 Guys please solve this asap, i have tried
=>this.image ==null;
=>refresh(),update() etc.
=>Dispose() also
 but none of them where success.... please what should i do?? 
Answers (3)