Visual Basic - UNA DUDA

Life is soft - evento anual de software empresarial
 
Vista:

UNA DUDA

Publicado por Danos (50 intervenciones) el 04/05/2006 21:06:35
UNA DUDA MUY GRANDE FOREROS.

ESTOY DESARROLLANDO UN PROYECTO, EL CUAL CONSTA DE TENER UN CONTADOR DE TIEMPO, ESTOY UTILIZANDO UN TIMER, CON 4 TEXT BOX DONDE EN CADA UNO CORREN LAS HORAS, MINUTOS, SEGUNDO, Y LAS DECIMAS, TODO FUNCIONA BIEN.

PERO MI DUDA ES?

QUE ME RECOMIENDAN QUE UTILICE PARA GUARDAR ESOS TIEMPOS, UNA VES QUE EL USUARIO CIERRA EL PROGRAMA, PARA CUANDO VUELVA A ABRIRLO, EL TIEMPO CORRA A PARTIR DEL TIEMPO EN QUE SE QUEDO.

PROBE CON UNA BASE DE DATOS UTILIZANDO EL OBJETO ADODC, CONECTANDO LA BASE DE DATOS, DONDE EN UNA TABLA CREE 4 CAMPOS 1 HORAS, 2 MINUTOS, 3 SEGUNDO, 4 DECIMAS.

Y GUARDA LOS TIEMPOS BIEN, PERO EL PROBLEMA ES CUANDO EMPIESA A CORRER EL TIEMPO LO SALTA BASTANTE, EJEMPLO

00:01:00:00

Y LO SALTA HASTA

00:05:00:00

LA VERDAD ES QUE NO ENTIENDO POR QUE, SI ALGUIEN TIENE UNA IDEA ME SERIA DE MUCHA AYUDA,

SALUDOS Y GRACIAS FOREROS

PONGO CODIGO PARA QUE VEAN EL FUNCIONAMIENTO DEL TIEMPO
____________________________________________________________
Option Explicit

Dim Iniciar As Single
Dim variable As Double
____________________________________________________________
' BOTON DE INICIAR EL TIMER

Private Sub Command1_Click()

variable = (Text1.Text * 3600) + (Text2.Text * 60) + (Text3.Text) + (Text4.Text)
Iniciar = Timer
Timer1.Enabled = True

End Sub
____________________________________________________________
' BOTON DE DETENER EL TIMER

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

Iniciar = Timer
Timer1.Enabled = False

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 = variable + 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)

Text1.Text = Format(horas, "00")
Text2.Text = Format(minutos, "00")
Text3.Text = Format(segundos, "00")
Text4.Text = Format(centesimas, "00")

DoEvents

End If

End Sub
___________________________________________________________
' BOTON DE AGREGAR TIEMPO

Private Sub Command3_Click()

Adodc1.Recordset.AddNew

End Sub
___________________________________________________________
' BOTON DE GUARDAR TIEMPO

Private Sub Command4_Click()

Adodc1.Recordset.Update
Adodc1.Refresh
Adodc1.Recordset.MoveLast
MsgBox "REGISTRO GRABADO CON EXITO!", 0 + 64

End Sub
___________________________________________________________
' BOTON DE ACTUALIZAR BASE DE DATOS

Private Sub Command5_Click()
Adodc1.Recordset.Requery
End Sub
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:UNA DUDA

Publicado por Sergio (4 intervenciones) el 05/05/2006 00:01:25
Me he parado ha hechar un vistazo y se me ocurre que el problema lo tengas en guardar el tiempo en formato decimal, en vez de hexagesimal en el programa o en la base de datos.
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