Hi there Everyone
I am writting a program POS in which i have employees database.
they get a code or we can say employee ID numbers.
100001
100002
100003
now i want to keep the recourd attached with picture ID as well
file names will be
100001.jpg
100002.jpg
100003.jpg

as i click the button to move in the records it should change the picture of the person whoes record in being displayed.
here is my code

Dim ImageFileName As String
Dim ImageFilePath As String
    ImageFileName = LblEmpCode.Caption
    ImageFileName = ImageFileName & ".jpg"
    ImageFilePath = "App"
    ImageFilePath = ImageFilePath & ".Path"
    ImageFilePath = ImageFilePath & " "
    Dim aand As String
    aand = Chr$(38)
    ImageFilePath = ImageFilePath & aand
    ImageFilePath = ImageFilePath & " "
    Dim quote As String
    quote = Chr$(34)
    ImageFilePath = ImageFilePath & quote
    ImageFilePath = ImageFilePath & "\Images\"
    ImageFilePath = ImageFilePath & "EmpPic\"
    ImageFilePath = ImageFilePath & ImageFileName
    ImageFilePath = imagefilePath & quote
    MsgBox ImageFilePath
    Picture1.Picture = LoadPicture(ImageFilePath)
    Picture1.Picture = LoadPicture(App.Path & "\Images\EmpPic\" & ImageFileName)

as my program loads employee ID is shown in LblEmpCode.Caption
in last 2 lines
Picture1.Picture = LoadPicture(ImageFilePath) -------- this gives error
where as
Picture1.Picture = LoadPicture(App.Path & "\Images\EmpPic\" & ImageFileName)
this works
i just want to know what am i doing wrong that this " Picture1.Picture = LoadPicture(ImageFilePath) " line is not working as it should
error
run-time error 75
path/file access error :'App.Path & "\Images\EmpPic\100001.jpg"

Dim ImageFileName As String
Dim ImageFilePath As String
    ImageFileName = LblEmpCode.Caption
    ImageFileName = ImageFileName & ".jpg"
    ImageFilePath = App.Path
    ImageFilePath = ImageFilePath & "\Images\EmpPic\"
    ImageFilePath = ImageFilePath & ImageFileName
    Picture1.Picture = LoadPicture(ImageFilePath)

sorry for the truble. small mistake i figured it out as soon i got the "" removed around App.path every thing fell in place and it is running.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.