Visual Basic - como puedo crear un cronometro

Life is soft - evento anual de software empresarial
 
Vista:

como puedo crear un cronometro

Publicado por cesar (1 intervención) el 27/04/2005 22:48:26
como podria realizar un cronometro con un timer
eh intentado con un ciclo for pero me manda al infinito...

ayuda por favor!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:como puedo crear un cronometro

Publicado por christian Chileno (10 intervenciones) el 28/04/2005 00:10:32
Necesitas un label, 2 botones y un timer
Espero que te sirva
Option Explicit

Dim Iniciar As Single

Private Sub Command1_Click()
Label1.Caption = "00:00:00:00"
Iniciar = Timer
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Label1.Caption = "00:00:00:00"
End Sub


Private Sub Timer1_Timer()
Dim dif As Single
Dim horas As Integer
Dim minutos As Integer
Dim segundos As Integer
Dim centesimas As Integer

If Timer > Iniciar Then
dif = Timer - Iniciar
Else
dif = 86400 - Iniciar + Timer
End If

centesimas = (dif - Fix(dif)) * 100
horas = Fix(dif) \ 3600
minutos = (Fix(dif) Mod 3600) \ 60
segundos = (Fix(dif) Mod 60)
Label1.Caption = Format(horas, "00") & ":" & Format(minutos, "00") & ":" & Format(segundos, "00") & ":" & Format(centesimas, "00")
DoEvents
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar