Mocco
Mocco

Reputation: 1223

Where to store images correctly in VS 2008 project?

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

Answers (3)

Craigt
Craigt

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:

Resource file

Upvotes: 2

Jimmy
Jimmy

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

gremo
gremo

Reputation: 48909

Resource files would help, they can carry images.

Upvotes: 0

Related Questions