borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Help?)Next Topic ( what is difference between VB and VB.Net ??) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : Not specify full path for file, possible?
Poster Message
biao81
Level: Guest


icon Not specify full path for file, possible?

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
| Quote Reply
dcostelloe
Level: VB Guru

Registered: 11-06-2002
Posts: 74
icon 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

strFileName  = gfCheckPath(App.Path) & "abc.jpg"
Picture1.picture=LoadPicture(strFileName),

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 :-)

Visit us today:
http://www.welford-costelloe.com
24-04-2003 at 10:52 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB.Net : Not specify full path for file, possible?
Previous Topic (Help?)Next Topic ( what is difference between VB and VB.Net ??) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder