Animate Event example for Visual Basic

This example shows how the Animate event can be used to toggle the use of a button to start and stop the animation.

Private Sub Lead1_Animate(ByVal bEnable As Boolean)
  If bEnable = True Then
    Command1.Caption = "&Stop Animation"
  Else
    Command1.Caption = "&Start animation"
  End If
End Sub

Private Sub Command1_Click()
   If Lead1.AnimationEnable = True Then
     Lead1.AnimationEnable = False
   Else
     Lead1.AnimationEnable = True
   End If
End Sub