Load image from folder in solution?

c#

Solution

It always take the path from the where executable is located(bin folder). So if you can access it using full path, problem will solved. Or you can have a configuration item for the root folder. then access like `Image.FromFile(rootFolder+ "Resources/circle.png");`. Anyway this issue wont be there when you deploy it.

And if you are using resource file,

<projectName>.Properties.Resources.<ImageName>;

will return the image.

Problem

I'm trying to load an image from a folder in the solution, but I only get a error message that it's not found. What have I done wrong? The code below is in the MainForm.cs that is at the same level as the Resource folder. Help is preciated! Thanks! ``` // Images Image imageCircle = Image.FromFile("Resources/circle.png"); // Set deafult picture on start pictureBox1.Image = imageCircle; ```

Original source