Reputation: 1223
I am learning how to use VS 2008 for building projects. I would like to embedd images which my app is using internally. What is the correct way? I know I can create a folder in my project but not sure how to access the file stored there, then.
Upvotes: 0
Views: 166
Reputation: 3580
A default win forms application adds a resource file to the solution. If you open it you can drag files onto it, and assign a name. Then access it in code like below
Properties.Resources.MyResourceName;
Default resource file:
Upvotes: 2
Reputation: 6171
Whether you put the images in a folder or not is a matter of preference. I personally do it to avoid clutter in the project directory.
You can access the resources using Assembly.GetManifestResourceStream
There is a write up here http://support.microsoft.com/kb/324567
Upvotes: 0