Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21260

photo dosnt update the correct pictures

$
0
0
i have a form with to photos that i can add
when i add does 2 photos or 1 photo then everything is ok
but when i add 1 photo and go back to add another photo then the first photo that i added is gone.
which ever photo i select and press edit it switches between them
only if i edit.
i checked the DB when i save for the first time and the 2 photos are there.

here is my code.
Code:

Dim CustPhoto As String 'this is the before picture
Dim CustPhotoAfter As String

when i edit the form with the pics
Code:

  Set rs = CN.Execute("SELECT CrdPhoto1,CrdPhoto2 FROM ColorCards WHERE CrdID= " & FrmColorCard.LsVw.SelectedItem.Tag)
        CustPhoto = rs!CrdPhoto1
        CustPhotoAfter = rs!CrdPhoto2
        If Dir$(rs!CrdPhoto1) <> "" Or Dir$(rs!CrdPhoto2) <> "" Then
        Set BttnPhoto.Picture = LoadPicture(rs!CrdPhoto1)
        Set BttnAfter.Picture = LoadPicture(rs!CrdPhoto2)
       
        CustPhoto = rs!CrdPhoto1
        CustPhotoAfter = rs!CrdPhoto2
        Else
        MsgBox "the picture/s has been removed", vbExclamation
        CustPhoto = ""
        CustPhotoAfter = ""
        Set BttnPhoto.Picture = Nothing
        Set BttnAfter.Picture = Nothing

with the subitems
Code:

Set BttnPhoto.Picture = LoadPicture(CmmDlgBefore.FileName)
        Set BttnAfter.Picture = LoadPicture(CmmDlgAfter.FileName)
        itm.EnsureVisible
        itm.Selected = True

in form load
Code:

CmmDlgBefore.InitDir = App.Path
CustPhoto = CmmDlgBefore.FileName

CmmDlgAfter.InitDir = App.Path
CustPhotoAfter = CmmDlgAfter.FileName

one more thing
do i have do dim each photo as string or is there a way to dim 2 photos with a as something?

Viewing all articles
Browse latest Browse all 21260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>