Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
Public Class Form1
Private EndZeit As DateTime
Private Function CountDown(ByVal datEnd As DateTime) As String
Dim intYear As Integer, intMonth As Integer
Dim intYD As Integer, intMD As Integer, intWD As Integer, intTD As Integer
Dim intHD As Integer, intND As Integer, intSD As Integer
Dim datStart As DateTime
datStart = Now
If DateDiff("s", datStart, datEnd) >= 0 Then
intYear = Year(datStart)
intMonth = Month(datStart)
intYD = Year(datEnd) - intYear
intMD = Month(datEnd) - intMonth
intTD = Microsoft.VisualBasic.DateAndTime.Day(datEnd) - Microsoft.VisualBasic.DateAndTime.Day(datStart)
intHD = Hour(datEnd) - Hour(datStart)
intND = Minute(datEnd) - Minute(datStart)
intSD = Second(datEnd) - Second(datStart)
If intSD < 0 Then
intND = intND - 1
intSD = intSD + 60
End If
If intND < 0 Then
intHD = intHD - 1
intND = intND + 60
End If
If intHD < 0 Then
intTD = intTD - 1
intHD = intHD + 24
End If
If intTD < 0 Then
intMD = intMD - 1
intTD = intTD + Microsoft.VisualBasic.DateAndTime.Day(DateSerial(intYear, intMonth + 1, 0))
End If
intWD = Int(intTD / 7)
intTD = intTD - (intWD * 7)
If intMD < 0 Then
intYD = intYD - 1
intMD = intMD + 12
End If
ProgressBar1.PerformStep()
Else
Timer1.Stop()
Label1.Font = New Font("Arial", 20, FontStyle.Bold)
CountDown = "Es ist soweit, Countdown beendet !"
Exit Function
End If
CountDown = "Es sind noch: " & vbCrLf & vbCrLf _
& intYD & " Jahr(e) und " & intMD & " Monat(e) und " & intWD & " Woche(n) und " & intTD & " Tag(e)" & vbCrLf & vbCrLf _
& intHD & " Stunde(n) und " & intND & " Minute(n) und " & intSD & " Sekunde(n)"
End Function
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = CountDown(EndZeit)
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
EndZeit = "18.12.2006 09:50:00"
Me.Size = New Size(350, 200)
Label1.Location = New Point(10, 10)
Label1.Size = New Size(320, 120)
Label1.Font = New Font("Arial", 8, FontStyle.Bold)
Label1.Text = ""
ProgressBar1.Location = New Point(10, 110)
ProgressBar1.Size = New Size(315, 20)
ProgressBar1.Style = ProgressBarStyle.Continuous
ProgressBar1.Step = 1
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = DateDiff("s", Now, EndZeit)
ProgressBar1.Value = 0
Timer1.Interval = 1000
Timer1.Start()
Timer1_Tick(sender, e)
End Sub
End Class