Results 1 to 3 of 3

Thread: Display images using timer event

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    43

    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

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    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

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    43

    Re: Display images using timer event

    Thanks Merri - you are a star

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width