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
 
Back
Top