testa aí
SEM ARMAZENAR em bd ou armazenando em formatos diferentes de DATA/HORA
Supondo q vc tenha 2 textbox
1 text_hora_inicial
1 text_hora_final
para os textbox eu usaria 'O usuario deverá digitar somente os numeros da hora de 0000 a 2359 ok?
no declarations coloca
dim hini(1) as byte
dim hfim(1) as byte
dim mintotal as byte
dim horatotal as byte
private sub text_hora_inicial_lost_focus()
x=text_hora_inicial.text
hini(0)=int(x/100)
hini(1)=x mod 100
text_hora_inicial.text=(format(text_hora_inicial.text,"00":00")
end sub
private sub text_hora_final_lost_focus()
x=text_hora_final.text
hfim(0)=int(x/100)
hfim(1)=x mod 100
text_hora_final.text=(format(text_hora_final.text,"00":00")
end sub
private sub calculatempo ' Válido para tempo menor do q 24 horas
if hfim(0)< hini(0) then
hfim(0)=hfim(0)-12
hini(0)=hini(0)-12
else
endif
if hfim(1)< hini(1) then
hfim(0)=hfim(0)-1
mintotal= hfim(1)+(60-hini(1))
horatotal= hfim(0)-hini(0)
else
if hfim(1)= hini(1)
mintotal= 0
horatotal= hfim(0)-hini(0)
else 'hfim (1)>hini(1)
mintotal= ( hfim(1)+(60-hini(1)))-60
horatotal= hfim(0)-hini(0)+1
endif
label_tempodecorrido.caption=format(horatotal,"00") &":" & format(mintotal,"00")
Não eskeça de dizer se funcionou e encerrar o tópico