hi,
I'm a new VB6 user as well as this forum also. Can someone tell me if it's possible to not specify a full path for picture source when we are doing vb program?
Since when people install a program, they choose to install in whatever folder they like. Then, if i am doing this Picture1.picture=LoadPicture("D:OrganizerPictureabc.jpg"), peopel will not be able to run my software correctly. But i have try to this
Picture1.picture=LoadPicture("Pictureabc.jpg"), assuming that my project is in the same folder as Picture folder. But it fail
Can someone tell me how to load a picture not specifying full path?
23-03-2003 at 01:05 PM
|
dcostelloe Level: VB Guru Registered: 11-06-2002 Posts: 74
Re: Not specify full path for file, possible?
Hi,
The way I would do it is either use the resource editor or the simple route by using the following:
Dim strFileName As String
Here is the Function:
Note: for some reason or other the backslash is not showing up.
So where you see a * add a backslash
Public Function gfCheckPath(ByVal strPath As String) As String
If Not Right(strPath,1) = "*" Then
strPath = strPath & "*"
End If
gfCheckPath = strPath
End Function
If you need to know how to use resource files let me know I'll send you a sample
Resource file will embed the image into your exe no need to read from disk.
Hope this helps
David.....
quote:biao81 wrote:
hi,
I'm a new VB6 user as well as this forum also. Can someone tell me if it's possible to not specify a full path for picture source when we are doing vb program?
Since when people install a program, they choose to install in whatever folder they like. Then, if i am doing this Picture1.picture=LoadPicture("D:OrganizerPictureabc.jpg"), peopel will not be able to run my software correctly. But i have try to this
Picture1.picture=LoadPicture("Pictureabc.jpg"), assuming that my project is in the same folder as Picture folder. But it fail
Can someone tell me how to load a picture not specifying full path?
[Edited by dcostelloe on 22-08-2004 at 02:51 AM GMT]
[Edited by dcostelloe on 22-08-2004 at 02:53 AM GMT]
[Edited by dcostelloe on 22-08-2004 at 02:53 AM GMT]
____________________________
Life is but a merry go round
around and around :-)