Dim minuto As Integer
Dim segundo As Integer = 0
Dim milisegundo As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
Label1.Text = hora.ToString.PadLeft(2, "0") & ":"
Label1.Text &= minuto.ToString.PadLeft(2, "0") & ":"
Label1.Text &= segundo.ToString.PadLeft(1, "0") & ":"
Label1.Text &= milisegundo.ToString.PadLeft(1, "0")
Label1.Refresh()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
milisegundo += 1
If milisegundo = 9 Then
milisegundo = 0
segundo += 1
If segundo = 59 Then
segundo = 0
minuto += 1
If minuto = 59 Then
minuto = 0
hora += 1
End If
End If
End If
Label1.Text = hora.ToString.PadLeft(2, "0") & ":"
Label1.Text &= minuto.ToString.PadLeft(2, "0") & ":"
Label1.Text &= segundo.ToString.PadLeft(2, "0") & ":"
Label1.Text &= milisegundo.ToString.PadLeft(1, "0")
Label1.Refresh()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
hora = 0
minuto = 0
segundo = 0
milisegundo = 0
Label1.Text = hora.ToString.PadLeft(2, "0") & ":"
Label1.Text &= minuto.ToString.PadLeft(2, "0") & ":"
Label1.Text &= segundo.ToString.PadLeft(2, "0") & ":"
Label1.Text &= milisegundo.ToString.PadLeft(1, "0")
Label1.Refresh()
End Sub
End Class
No hay comentarios:
Publicar un comentario