Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Picture boxes get stuck....

mOskimOski Member Posts: 44
I made simple program that makes the picture box to move from the top of the form to go down up to the middle of the form when I clicked a label box. I have 5 labelboxes and picture boxes and 10 timers to make the picture boxes move, 2 for each picture box because if a picture box was already in the middle of the form and a different label box was clicked, the other picture box would move up and another one would go down.

Now my problem is that if I clicked on a label and the picture box is not yet positioned in the middle of the form and I clicked another label box, another picture box would go down and when that happens the program stucks up making the 2 pictureboxes stuck half way through the form.

I've been trying to solve this for days but I still haven't found the solution.... Need help... (T_T)

thank you...

Comments

  • dokken2dokken2 Member Posts: 532
    there's a number of ways to handle this, here's one-

    [code]
    Private Sub Label1_Click()
    If Me.Timer1.Interval = 0 Then
    'put picture at inital spot
    Me.Image1.Top = 480
    'turn on timer
    Me.Timer1.Interval = 100
    'disable label so user can't click again
    'until the picture movement has stopped
    Me.Label1.Enabled = False
    End If
    End Sub

    Private Sub Timer1_Timer()
    Me.Image1.Top = Me.Image1.Top + 20
    'check position of picture
    'if at certain position, stop timer
    If Me.Image1.Top > 1000 Then
    'stop timer
    Me.Timer1.Interval = 0
    'enable label again
    Me.Label1.Enabled = True
    End If
    End Sub
    [/code]
  • mOskimOski Member Posts: 44
    : there's a number of ways to handle this, here's one-
    :
    : [code]:
    : Private Sub Label1_Click()
    : If Me.Timer1.Interval = 0 Then
    : 'put picture at inital spot
    : Me.Image1.Top = 480
    : 'turn on timer
    : Me.Timer1.Interval = 100
    : 'disable label so user can't click again
    : 'until the picture movement has stopped
    : Me.Label1.Enabled = False
    : End If
    : End Sub
    :
    : Private Sub Timer1_Timer()
    : Me.Image1.Top = Me.Image1.Top + 20
    : 'check position of picture
    : 'if at certain position, stop timer
    : If Me.Image1.Top > 1000 Then
    : 'stop timer
    : Me.Timer1.Interval = 0
    : 'enable label again
    : Me.Label1.Enabled = True
    : End If
    : End Sub
    : [/code]:


    I just tried the code and its ver helpful (^_^) , thank you so much for the help! (^_^)

    thanks again (^_^) ----> mOski
Sign In or Register to comment.