Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my code its not working, its showing file not found any one can help me please

C#
string myImagePath = @&quoTempImage\TempImage.jpg";
           TempImage = Image.FromFile(myImagePath);
           pictureBox2.Image = TempImage;
Posted

Well, try with full path. If that one works, your executable runs somewhere where this relative path is not valid to the file. Be aware that your code is compiled to bin\debug or bin\release.
 
Share this answer
 
Have you past code properly.
Following code have syntax error.
string myImagePath = @&quoTempImage\TempImage.jpg";
If you want to use relative path you need to add image in to you project solution.
Following is the code to load image in Picture Box.
C#
var image = Image.FromFile(realtiveImagePath);
          pictureBox1.Image = image;
 
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