| | |
how to load an image to a form
Thread Solved |
Hi,
I have a problem. I have put up an image on a form of .jpeg format.(copy and pasted).. But when i save it... it works fine at home.. .when i copy it on a cd... it is not saving the background image. Rather ... when I try to open it on an other computer.. the background image is gone. I'm not finding any reason ..why thats happening.. i'd be glad if someone can help me. Should i save the image on the other computer too and give a path name or something using code?? If yes... what is the code like? Please help me. And why does it happen so? Thank you.Forgot to add this... i'm using vb6.
I have a problem. I have put up an image on a form of .jpeg format.(copy and pasted).. But when i save it... it works fine at home.. .when i copy it on a cd... it is not saving the background image. Rather ... when I try to open it on an other computer.. the background image is gone. I'm not finding any reason ..why thats happening.. i'd be glad if someone can help me. Should i save the image on the other computer too and give a path name or something using code?? If yes... what is the code like? Please help me. And why does it happen so? Thank you.Forgot to add this... i'm using vb6.
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
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:
Let me know what you think.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
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:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
form1.picture = picture1.picture
Let me know what you think.
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.
Hi again,
Can you tell me.. whats wrong with this code...
Can you tell me.. whats wrong with this code...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Form_Load() Form1.Picture = App.Path & "\096.jpg" End Sub
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.
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.
Hi,
It is giving a compile error at & as type mismatch.
Where am i wrong . Please help.
Private Sub Form_Load()
Form1.Picture = App.Path & "\096.jpg"
End SubIt is giving a compile error at & as type mismatch.
Where am i wrong . Please help.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Form1.Picture = App.Path a + "\096.jpg"
its giving a syntax error
![]() |
Similar Threads
- How to Resize Image with form resize event (Visual Basic 4 / 5 / 6)
- How do i load a image on the same page ? (Site Layout and Usability)
- how to load an image in c file (C)
- stuck in cgi image stuff (Python)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Text Box Newbie help
- Next Thread: VB5 Company Name Version Info
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






