window forms: timer press the button every 60 seconds

  • Thread starter Thread starter Patrick96
  • Start date Start date
P

Patrick96

Guest
Task:

You have to press the "self control" button every 60 seconds, otherwise the login interface reappears, so that the porter has to register again.

Below is the program, but you can only press it once and you have to log in again. How do I program the gatekeeper to press the button every 60 seconds?


int duration = 60; // Duration of time
private void timer1_Tick(object sender, EventArgs e)

{
duration--;
textBox1.Text = duration.ToString();
if (duration == 0)
{
timer1.Stop();
MessageBox.Show("Entrance area not occupied");
this.Hide();
FormLogin fm = new FormLogin();
fm.ShowDialog(this);
}
}

private void btn_selfcontrol_Click(object sender, EventArgs e)
//Stopp the Timer
{
timer1.Stop();
}

Continue reading...
 
Back
Top