Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
visual basic imagen
Public Class Form1
'esto se pone al empieso del programa
'se declara una variable que es la que tomara el valor del timer
Dim t As Integer
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
'programacion del timer
'El timer estará aumentando su valor de uno en uno
t = t + 1
'Cuando el timer llegue a 450 se reiniciara en 26
If t >= 450 Then
t = 26
End If
'La imagen se moverá de forma horizontal tomando el valor del timer
PictureBox1.Left = t
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'prigramacion del Boton 1
'Se activa el timer
Timer1.Enabled = True
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'programacion del Boton 2
'Se desactiva el timer
Timer1.Enabled = False
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'programacion del form1
'Al compilar el programa el timer comienza en 26
t = 26
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.