Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
I am using a string to store the file path of an image in a sql server database. I want to call the file path from the database in a vb.net winform project but not show it because I want to just show the image. Can anyone advise me on how to do this? Thanks in advance for your help.

EDIT:

Just to be clear, the image path is stored as a string in the database from one form, I want to call the path in another form, but I don't want to show the path, I want to show the actual image the path points to.
Posted
Updated 8-Aug-14 3:40am
v2

By using the following line of code I was able to solve my problem.

VB
pbImage.Image = Image.FromFile(CStr(dtPersons.Rows(0).Item(3)))
 
Share this answer
 
You can simply put a 'PictureBox' control to your form and set its 'ImageLocation' property with the URL you are getting from database itself. This will take care to display the image from the specified path.

Ex :-

C#
pictureBox1.ImageLocation = @"D:\SMRUTI\Projects\CodeProjTest\TestApp2-Win\Images\chat1.jpg";


Hope this will definitely of help to resolve your issue.
 
Share this answer
 

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