Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to show image on form load on picturebox from project folder.
did anyone have code pls forward it.
thanks in advance.
Posted
Comments
[no name] 25-Aug-12 13:46pm    
Get the image and show it. What is the problem? Just looking for someone to do it for you?

hi friend use like this

create a folder in your project .exe file location like (drivename:\\projectname\bin\Debug\img) and your image there.
then execute this code

C#
private void Form1_Load(object sender, EventArgs e)
       {
           pictureBox1.Image = Image.FromFile(Application.StartupPath + "\\img\\1.jpg");
       }


regards
sarva
 
Share this answer
 
v2
Your working directory should be the project folder, so Image.FromFile("filename.bmp") should actually work fine.
C#
Path.GetDirectoryName(Application.ExecutablePath);
will give you the folder the code is running from, though.
 
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