Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tring to load a image in a picturebox through code

Status
Not open for further replies.

jakeir

Programmer
Apr 7, 2009
25
US
Hi,

I am tring to load a picturebox through code and have found a lot of metthods on the net and in books I have, but nothing works. I either just get a picturebox with no image in it (and no errors), or I the things they suggest does not exist. For example, a few places suggested that this should work Picturebox.picture = LoadPicture("C:\myImage.jpg"), here I get an error basicly saying that this function does not exist., and the extention Picture does not exist either. I do not know if I need a special reference or what; but it seems like this should be simple to do. So if someone can show me how to do this I would realy appreciate it.

Thank you

 
Code:
PictureBox.Image = Drawing.Image.FromFile("C:\MyImage.jpg")
 
Thanks for the reply I just tryed this, unforuantly it did not work. I do not get an error buit it nothing appears in the Picturebox. Can it be problem because I am using a jpg? do i have to do something else?
Is there another way to go. All I am looking to do is diplay a photo on a form, and I have beed trying thisn for todays now it should not be this hard.
Thanks
 
There's no issues with the code or with jpg's. Are you sure your application is hitting this line of code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top