frmDetails.Elm_Pict.Image = System.Drawing.Image.FromFile(
"Pictures\h.jpg")which is giving me a FileNotFoundException error but the path is correct!
I would greatly appriciate any advice how to fix this simple error!
Thanks,
Campsoup1988
frmDetails.Elm_Pict.Image = System.Drawing.Image.FromFile(
"Pictures\h.jpg")which is giving me a FileNotFoundException error but the path is correct!
I would greatly appriciate any advice how to fix this simple error!
Thanks,
Campsoup1988
FileNotFoundException error with pictures
smark
Sorry I didn't mean to suggest you couldn't use relative paths, you can certainly.
The key is understanding where that exe is actually running from and making sure the image is in the correct path. If you're debugging the project it will be under the Build Output Path which is found under the project properties. This is typically set to the Bin directory.
So if you copy the pictures folder to the Build Output path your orginal code should work fine.
If you want to ensure your using the correct path in your code you can always build it at run time.
For example:
rwerner
That has solved the problem!
~~campsoup1988
JYB
CSH100885