Display images using timer event
I'm stuck with the proper way to display images. My form gaot 9 images
image1 to image 9. I want to display only four images initially in the following order with a timer delay but don't get it right. Please help. Never sed timer before
Private Sub Timer1_Timer()
'===deal one card at a ime
z = PlaySound(App.Path & "/sounds/card.wav", 0)
if Image1.visible = false then image1.vissible = true
z = PlaySound(App.Path & "/sounds/card.wav", 0)
image1.vissible = true then Image7.visible = True
z = PlaySound(App.Path & "/sounds/card.wav", 0)
image7.vissible = true then Image2.visible = True
z = PlaySound(App.Path & "/sounds/card.wav", 0)
image2.vissible = true then Image8.visible = True
End Sub
Re: Display images using timer event
All timer code gets ran at once unless you give different settings for each run. This code changes the visibility of a control, if a control is not visible then it makes it visible and exists.
The next time the timer event launches the control is visible, so it proceeds to the next check to see if that control is visible. And the same routine keeps going until the last Else, after which all images are hidden.
Code:
Private Sub Timer1_Timer()
' play sound
z = PlaySound(App.Path & "/sounds/card.wav", 0)
' see if image is not visible, make visible
If Not Image1.Visible Then
Image1.Visible = True
ElseIf Not Image7.Visible Then
Image7.Visible = True
ElseIf Not Image2.Visible Then
Image2.Visible = True
ElseIf Not Image8.Visible Then
Image8.visible = True
Else
' hide so we have kind of a loop
Image1.Visible = False
Image7.Visible = False
Image2.Visible = False
Image8.Visible = False
End If
End Sub
Re: Display images using timer event
Thanks Merri - you are a star