View Single Post
  #3 (permalink)  
Old January 17th, 2013, 08:28 PM
TheMysticRuler TheMysticRuler is offline
Registered User
Points: 24, Level: 1
Points: 24, Level: 1 Points: 24, Level: 1 Points: 24, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default

While were on the subject, why does the code not work if the code in the handlers is switched around (swapped)?
Original code left in comments.

Code:
 ' Move the button to (10, 10), disable tmrMoveLeft, and enable tmrMoveRight.
    Private Sub tmrMoveLeft_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrMoveLeft.Tick
        'tmrMoveLeft.Enabled = False
        'tmrMoveRight.Enabled = True

        tmrMoveLeft.Enabled = True
        tmrMoveRight.Enabled = False
        btnStop.Left = 10
        btnStop.Top = 10
    End Sub

    ' Move the button to (200, 200), disable tmrMoveRight, and enable tmrMoveLeft.
    Private Sub tmrMoveRight_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrMoveRight.Tick
        'tmrMoveLeft.Enabled = True
        'tmrMoveRight.Enabled = False

        tmrMoveLeft.Enabled = False
        tmrMoveRight.Enabled = True
        btnStop.Left = 200
        btnStop.Top = 200
    End Sub
It only seems to work once; to move the button to (10,10), but then it stops.

Being completely new to VB programming, I dont know how to step through the code; or for that matter know what order it goes about executing.

Thanks for any help.

Last edited by TheMysticRuler; January 17th, 2013 at 08:30 PM..
Reply With Quote