Hi Frndz,
Functionality: Timer Tick Display Label Value
Set Timer interval 5 sec
Now take one Static variable now decrement this static variable value every 5 seconds
COunt = (Convert.ToInt32(COunt) - 5).ToString();
Logic :
Timer timer = new Timer();
static string COunt = "21";
void timer_Tick(object sender, EventArgs e)
{
COunt = (Convert.ToInt32(COunt) - 5).ToString();
if (COunt == "16")
{
label2.Text = "pls wait for 15 sec";
}
if (COunt == "11")
{
label3.Text = "pls wait for 10 sec";
}
if (COunt == "6")
{
label4.Text = "pls wait for 5 sec";
}
if (COunt == "1")
{
label5.Text = "it's almost over";
}
}
private void Form1_Load(object sender, EventArgs e)
{
timer.Tick += new EventHandler(timer_Tick); // Everytime timer ticks, timer_Tick will be called
timer.Interval = (1000) * (5); // Timer will tick evert 5 seconds
timer.Enabled = true; // Enable the timer
timer.Start(); // Start the timer
}
Hope this helpful!
Thanks