Malini
Malini

Reputation: 43

How to get the image path from Resource file in c# windows forms?

I want to get the image from Resource folder in c# windows application? already i tried in different ways. But i dint get the correct solution.

i need the path: "c:test\windowsapp\Resouces\bar.png" instead of start-up and executable path etc.Help me

Upvotes: 4

Views: 21834

Answers (1)

animaonline
animaonline

Reputation: 3804

Try this:

var filePath = System.Reflection.Assembly.GetExecutingAssembly()
                   .Location + @"\..\..\Resources\bar.png";

If your image is a valid resource, you can access it through: Properties.Resources

Upvotes: 3

Related Questions