In this post you can learn how to Make Countdown Timer in Visual Basic it is very easy task just take 3 buttons from tool box for start stop and reset after that you should use the below coding as per video instruction.

Public Class Form1 Dim ppspn As New TimeSpan() Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ppspn = New TimeSpan(0, CInt("30"), 0) End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ppspn = ppspn.Subtract(New TimeSpan(0, 0, 1)) Label1.Text = String.Format("{0} Mins : {1} Secs", ppspn.Minutes, ppspn.Seconds) If ppspn.Minutes = 0 AndAlso ppspn.Seconds = 0 Then Timer1.Stop() MessageBox.Show("done") End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Start() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Timer1.Stop() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Timer1.Stop() Label1.Text = "0" End Sub End Class
 
Top