Question Bitmap paths not working with the exe

kiwigirl

New member
Joined
Aug 12, 2008
Messages
2
Programming Experience
Beginner
Hi all
I've just joined, so i'm not sure what correct etiquette is and whether I'm even posting in the right place, but heres my problem:

I have a simple program that loads a bitmap into a picturebox if the answer given in the cbo was correct. I was using:
strTick = "H:\pics\tick.bmp"
imgAnswer1.Image = System.Drawing.Image.FromFile(strTick)

I realise the problem is the path is hard coded and therefore the exe cannot find the bitmaps - I'm wanting to fix this, so students can use just the exe.

After referring to msdn i've embedded bitmaps, but keep getting an internal error.
Could someone pls suggest the best way for a novice to do this! :D
Thanks heaps
 
Add the image to project resources. Use My.Resources.Tick in code.
 
Thanks John, i had done this, but i only want to give the students the exe to run, and it wont work, I get "The application failed to initialize properly". I used to do this with vb6 and it work fine - bitmaps displayed without requiring a resource file.

imgAnswer1.Image = My.Resources.tick
 
The resources are compiled into the exe, so you must be having other problems. I think the error is common when .Net is not installed.
 
Back
Top