victor64 (6/2/2009)
Hello, I am trying to view PNG files listed in an ACCESS file, the PNG files are on the same path as the application. Including the following syntax: /intro.png in the table is not working. Can you please help me with the proper syntax to view the PNG files in the same path as the ACCESS file. Well Victor this will depend on a few things. Does this database only store the filename and location of these files? If true then you don't need a database you can load all you pictures from code. If it does then your app will only work on your computer. Now the App.Path is good enough for this and 90% of the time your app will be running from a folder. If it runs from the root of a drive then that will cause a problem. What I do is use a String variable Ap to find the app location. If you have multiple Forms that need this location then declare it as Public in a Module. Option Explicit
Dim Ap As String
Private Sub Form_Load()
If Right(App.Path, 1) = "\" Then Ap = App.Path Else Ap = App.Path & "\" End If
End Sub
Private Sub Command1_Click()
Picture1.Picture = LoadPicture(Ap & "intro.png ")
End Sub
'Or if you want them in a seperate folder then just add the folder name.
Picture1.Picture = LoadPicture(Ap & "foldername\" & "intro.png ")
KeithI've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
|