In what directory does Visual Studio look for referenced file?

Hi,

I need to add a bitmap file to MapPoint, and would like to reference it by its short name, not a fulp path name.  Where could I place it so that VS can find it simply by name, such as "myBitmap.bmp"?

Thanks,
Bob

ba272Asked:
Who is Participating?
 
SmithJWCommented:
apologies

that should read:

String TheBitmapLocation = Application.StartupPath + "myBitmap.bmp";
0
 
dunglaCommented:
same with your executable file directory
0
 
SmithJWCommented:
To reference by just name it must be in the same folder as the exe AKA the Application Folder.

However, when running in debug mode, the path for Application Folder is not necesarily the same as the .exe path (other things can cause this to change too), therefore its better to specify the path relative to the EXE as follows:

String TheBitmapLocation = Application.ExecutablePath + "myBitmap.bmp";



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.