Reputation:
How can I display an image in C# or VB when the name is in a database?
I am using visual studio 2008 VB or C#
I want to display an image on a windows form The image name is in a SQL2005 Database The image is stored in a directory structure.
Ideally I would also like to be able to browse a directory select an image and add the image name to SQL2005 and add the image into the directory structure for new records
Upvotes: 1
Views: 1340
Reputation: 103607
in C#, use a PictureBox... Then to load the image you can use:
pictureBox1.Image = Image.FromFile("c:\\filename.jpg");
replace the file name and path with the value loaded from the database
Upvotes: 3