Cómo crear un cronómetro en Visual Basic

0


El código es el siguiente:

'Declaracion de variables
Private Hora As Integer = 0
Private Minuto As Integer = 0
Private Segundo As Integer = 0
Private Milisegundo As Integer = 0
' Sub Procedimiento
Sub MostrarTiempo()
 LblTiempoConexion.Text = Hora.ToString.PadLeft(2, "0") & ":"
 LblTiempoConexion.Text &= Minuto.ToString.PadLeft(2, "0") & ":"
 LblTiempoConexion.Text &= Segundo.ToString.PadLeft(2, "0") & ":"
 LblTiempoConexion.Text &= Milisegundo.ToString.PadLeft(1, "0") & ":"
 LblTiempoConexion.Refresh()
 End Sub
'Comienzo a realizar las operaciones y refresco el subprocedimiento
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 += 1
 Hora += 1
 End If
 End If
 End If
 MostrarTiempo()
 End Sub

Gracias por apoyar el libre conocimiento con tu donación!
Bitcoin: bc1q4sw9260twfcxatj8mjp7358cyvrf8whzlelyhj
Ethereum: 0xFb93D2a3c9d1A0b83EE629c2dE1725BCa192e581
Litecoin: LbFduJmHvQXcpCnwfUT7aJ4DYoWSL3iQw8
Dogecoin: D7QQVqNR5rk215A4zd2gyzV9P2bLQtZHFV
Transferencia bancaria en México:
Cuenta CLABE: 661610005838513425 Nombre: Masterhacks LATAM Banco: Alternativos

Unete a nuestros grupos:
WhatsApp: https://chat.whatsapp.com/HcazyklpyeU4X3BF657KFQ
Telegram: https://t.me/masterhacks_net
Canal de WhatsApp https://whatsapp.com/channel/0029VaBBLCn5vKAH9NOWCl3K

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *