Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/06/2011, 14:16
Avatar de servantsoftware
servantsoftware
 
Fecha de Ingreso: abril-2011
Ubicación: 1 Pedro 4.11
Mensajes: 94
Antigüedad: 13 años, 1 mes
Puntos: 3
Respuesta: Descontrol en el control time

mira el codigo abierto:

Código:
Option Explicit
Dim ss As Integer, mm As Integer, hh As Integer
Código:
Private Sub TMPC1_Timer()
' Propiedades en diseño: Enabled = False,  Interval = 1000
ss = ss + 1
If ss = 60 Then
    ss = 0
    mm = mm + 1
End If
If mm = 60 Then
    ss = 0
    mm = 0
    hh = hh + 1
End If
txtPC1.Text = Format(hh, "00") & ":" & Format(mm, "00") & ":" & Format(ss, "00")
End Sub
Esto es lo que hago, son 10 maquinas y cada una tiene un time osea 10 times, cada vez que se le da el boton iniciar hace el conteo con el codigo anterior.

cada uno de estos time contiene el mismo codigo, se que podria hacerce para que un solo isiera todo pero no se hacerlo todavia.

con esto llamo el metodo:

Código:
Private Sub PC1Iniciar_Click()
If PC1Iniciar.Caption = "Iniciar" Then
    ss = 0: mm = 0: hh = 0
    TMPC1.Enabled = True
    TmPC1Detener.Enabled = True
    
    Else
    TMPC1.Enabled = False
    PC1Iniciar.Caption = "Iniciar"

    End If
End Sub
Imagen: