Thread: [Solved] change the image by clicking
View Single Post
 
Old 03-22-2019, 11:36 PM
matapagi2019 matapagi2019 is offline Windows XP Office 2007
Novice
 
Join Date: Mar 2019
Posts: 12
matapagi2019 is on a distinguished road
Default change the image by clicking

I want to replace userform lebel1 picture ("image_1.bmp") into ("image_2.bmp") after clicking once, and returning it again to ("image_1.bmp") after the second click.
But the following code does not change it.
Is there a solution for this?

Code:
Private Sub UserForm_Initialize()
    Label1.Picture = LoadPicture("D:\My Pictures\Image_1.bmp")
End Sub

Private Sub CommandButton1_Click()
    If Label1.Picture = LoadPicture("D:\My Pictures\Image_1.bmp") Then
        Label1.Picture = LoadPicture("D:\My Pictures\Image_2.bmp")
    Else
    End If
End Sub
For all help, thanks a lot.
Reply With Quote