Best method for including a static file within project

  • Thread starter Thread starter B. Chernick
  • Start date Start date
B

B. Chernick

Refresh my memory please. Assume you have a static (i.e. text or xml) file
you want to include in your project (VB, Visual Studio 2005). What is the
best (simplest) method for accessing it programatically? (Feel like I'm
forgetting something.)
 
B. Chernick said:
Refresh my memory please. Assume you have a static (i.e. text or xml) file
you want to include in your project (VB, Visual Studio 2005). What is the
best (simplest) method for accessing it programatically? (Feel like I'm
forgetting something.)

Hi B,

Easiest way to add a file to a project is by using the Resources file in
Properties. Open Resources and select Add->Existing file... You will then
get a type safe reference to the file based on file type, Image, String,
byte[] etc. and the file will be incorporated in the assembly.

Image img = Properties.Resources.MyFile
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top