I am trying add picture boxes dynamically. My code is as
PictureBox picture = new PictureBox
{
Name = "pictureBox",
Size = new Size(100, 150),
Location = new Point(14, 17),
Visible=true
};
picture.ImageLocation = @"Image\80knhk00003.jpg";
pnlDisplayImage.Controls.Add(picture);
I have created Images Folder in project and added this image. Still when I run my code I can see only red cross.
I tried doing google. And I am getting similar solutions only.
I dont know what is wrong in my code.
Along with this if I am storing image file location in database then how can I display such images in picture box?
Please help
You picture doesn’t get copied to the binary folder.
Add the jpg file into the solution. Open it properties (right click on the file name – properties). Enable the Copy to Output Directory option. Also enable it for the Images folder.