# Another vb.net queiry hehe

Discussion in 'Computing, Science, and Technology' started by Gatzy118, Aug 27, 2008.

1. ### Gatzy118New Member

Joined:
Jan 7, 2008
Messages:
350
0
Device:
iPod touch
well. I import a picture to my resources but when i run this code...

Picturebox1.image = image.fromfile("image.png")

It says file not found. If i put the picture in the debug folder then it works as that is the current dir. However what do i need to do so it works once published and during debugging?
2. ### MountainDewNew Member

Joined:
Feb 23, 2008
Messages:
194
1
Device:
iPod touch
Try putting the full path. "C:\path\to\image.png"
3. ### Gatzy118New Member

Joined:
Jan 7, 2008
Messages:
350
0
Device:
iPod touch
i cant put the full path because it depends on where the program installs to. I need a relative path but if i put it in a resources folder in the solution explorer i dont know how to embed it
4. ### MountainDewNew Member

Joined:
Feb 23, 2008
Messages:
194
1
Device:
iPod touch
Then this is what I do in VB6, donno if it it's the same for .NET
Code:
    App.Path & "\picture.png"

App.Path returns the program's directory
5. ### micaheljcabooseWell-Known Member

Joined:
Jan 20, 2008
Messages:
1,855
82
Usually I can't get any file recognitions while debugging. So just try to publish what you have already and place the png in there to see if it works.
6. ### Gatzy118New Member

Joined:
Jan 7, 2008
Messages:
350
0
Device:
iPod touch
ive decided to just publish and copy the resources into a folder before creating an installer
7. ### hoogerBanned

Joined:
Sep 29, 2007
Messages:
419
2
Lets say it installed to "c:/users/me/blah/"

and the picture is in "c:/users/me/blah/resources/pic.png"

Just type:

Picturebox1.image = image.fromfile("/resources/image.png")

My vb is a bit rusty, perhaps i should go look at my old work, but that should work...

Joined:
Jan 7, 2008
Messages:
350