There is a couple of solutions.... one is to put the picture in the same folder as the VB EXE that is going to be running it. And then use the code
form1.picture = app.path & "\picturename.jpg"
Another alternative, is to use a picturebox.... and set it's attributes to hidden. Set it's pictures property to the image you want. You should be able to get away without having to move the file around everywhere. Copy and paste.... you should be able to paste it into a picture box... but I'm not positive. Anyway, if you use a picture box, you could set the form with:
form1.picture = picture1.picture
Let me know what you think.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Well, That depends entirely on portability, and what you are after. If you want it to be contained within the EXE... so you don't have to try to keep track of such and such.jpg, then it would be better to do it in a picturebox. The drawback to this, is EXE file size, and loading time... but ultimately, it's a matter of what you are trying to accomplish.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
There is nothing wrong with that code.... UNLESS:
1) the form that you are trying to load the image to is NOT called form1
2) the file "096.jpg" is NOT in the same folder as the EXE file you created.
Now, On the second note, (I don't remember the path, but you could do a msgbox app.path to find out), the file 096.jpg MUST BE IN THE SAME FOLDER as the program. If you make the program an EXE (file, make exe) then that EXE must be in the same folder as the picture file when the program runs, in order for it to work. If you are using the VB IDE (clicking start, and running it from within VB) then you'll have to know the path that it's running, and put the picture file there.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Form1.Picture = App.Path + "\096.jpg"
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Hi,
Try this one if it works:
Form1.Picture = LoadPicture(App.Path & "\096.jpg")
hope it work.
Newvbguy
NewVBguy
Junior Poster in Training
71 posts since Mar 2005
Reputation Points: 13
Solved Threads: 3
Did you try the loadpicture method that vbnewguy suggested?
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215