Visual Basic - Alguien me puede ayudar con este contador de horas

Life is soft - evento anual de software empresarial
 
Vista:

Alguien me puede ayudar con este contador de horas

Publicado por julian (2 intervenciones) el 09/04/2007 05:23:43
'Nota:como puedo hacer que este contador me calcule el valor del tiempo en un texbox en 'dinero

Option Explicit
Private Time As Double
Dim cal As Double
Dim timemin As Double

Private Function CalculateTime(Time As Double) As String
Dim TimeHour As Double
Dim strTimeHour As String
Dim timemin As Double
Dim strTimeMin As String
Dim TimeSec As Byte
Dim strTimeSec As String
Dim CalcTime As String



'Calculate the actual times
TimeHour = Int((Time / 60) / 60)
timemin = Int(Time / 60)
timemin = timemin Mod 60
TimeSec = Int(Time Mod 60)

'Change times to appropriate formats
strTimeMin = timemin
If Len(strTimeMin) = 1 Then
strTimeMin = "0" & strTimeMin
End If

strTimeSec = TimeSec
If Len(strTimeSec) = 1 Then
strTimeSec = "0" & strTimeSec
End If

strTimeHour = TimeHour
If Len(strTimeHour) = 1 Then
strTimeHour = "0" & strTimeHour
End If

'Assign the appropriate values to the label
CalculateTime = strTimeHour & ":" & strTimeMin & ":" & strTimeSec

End Function

Private Sub cmdClear_Click()
Time = 0
Timer1.Enabled = False
lblTime = "00:00:00"

cmdClear.Enabled = False
cmdStop.Enabled = False
End Sub

Private Sub cmdStart_Click()
Timer1.Enabled = True
cmdClear.Enabled = False
cmdStop.Enabled = True
cmdStart.Enabled = False
End Sub

Private Sub cmdStop_Click()
Timer1.Enabled = False
cmdClear.Enabled = True
cmdStart.Enabled = True
cmdStop.Enabled = False
End Sub

Private Sub Form_Load()
lblTime.Caption = "00:00:00"
Time = 0
End Sub

Private Sub Text1_Change()
Text1.Text = Time + calculpresio
End Sub

Private Sub Timer1_Timer()
Time = Time + 1
lblTime.Caption = CalculateTime(Time)
End Sub

Private Function calculpresio() As Double
cal = Text1 + 10

End Function

Private Sub Timer2_Timer()
Text1.Text = Time

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
sin imagen de perfil
Val: 119
Ha disminuido 1 puesto en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

RE:Alguien me puede ayudar con este contador de ho

Publicado por Christian (713 intervenciones) el 09/04/2007 15:35:01
Cual seria el uso ? parece un tarifador de un cyber , suponele que cobras $ 1 los 15 min , y vos pones a correr un timer que te 2 horas los convertis a min y con regla de 3 sacarias cuanto pagaria
Vi muy por encima tu codigo , pero ...

Dim TimeHour As Double
TimeHour = Int((Time / 60) / 60)

declaras una cosa y asignas otra ? si mal no recuerdo INT toma la parte entera , entoces para que double , no?
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