boa tarde,
estou com dificuldades em fazer um contador regressivo onde mostre os dias, horas, mins e segundos que faltam p/ determinado evento.
usei este código porém ele não calcula o tempo restante, ele faz um apanhado geral ... :/
ex.: tenho um evento para daqui 2 dais.
ele me mostra 2 dias 50 hrs, 3.000 min, etc.
onde seria: 2 dias, 2 hras, min, segundos restantes para o evento.
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim data As Date
data = "22/12/2013"
'Msg = "FALTAM " & DateDiff("d", Now, TheDate) & " DIAS PARA NOSSA VIAGEM!!! \O/ \O/ \O/ :D "
'MsgBox(Msg)
Label6.Text = DateDiff("s", Now, data)
Label4.Text = DateDiff("m", Now, data)
Label2.Text = DateDiff("h", Now, data)
Label1.Text = DateDiff("d", Now, data)
If Label6.Text = 0 Then
Label6.Text = 59
Label4.Text = Label4.Text - 1
ElseIf Label4.Text = 0 Then
Label4.Text = 59
Label2.Text = Label2.Text - 1
ElseIf Label2.Text = 0 Then
Label2.Text = 23
Label1.Text = Label1.Text - 1
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
End Sub
End Class
alguém poderia me ajudar a consertar isso?
Obrgado.