Open an image

Mickeys
Mickeys used Ask the Experts™
on
Instead of writing the hole search way to a file I would just like the program to know that it will get the image in the project. How do I write that?

Right now I need to do this
Bitmap cardImage = new Bitmap("C:\\Documents and Settings\\MFL\\Dokumenter\\Visual Studio 2008\\Projects\\Black_Jack\\Black_Jack\\images\\53.gif");
            backImage = cardImage;

I want to be able to run the app on diffrent computers
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Digital Marketing (Hospitality)
Commented:
Hi Mickeys,
You can get the current program's drive via .net built-in function called "system.io.directory.getcurrentdirectory".
eg:
Bitmap cardImage = new Bitmap(Directory.GetCurrentDirectory() + "\\images\\53.gif");

Check this site for further details regarding mentioned:
http://msdn.microsoft.com/en-us/library/system.io.directory.getcurrentdirectory.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial