Hi, is there any possibility to create a countdown for 1 year and disable login for windows form?
The countdown will not stop if the user logout the app or shutdown their PC.
- int OrigTime = 1800;
-
- private void button1_Click(object sender, EventArgs e)
- {
- Timer timeX = new Timer();
- timeX.Interval = 1800000;
- timeX.Tick += new EventHandler(timeX_Tick);
- }
-
- private void timeX_Tick(object sender, EventArgs e)
- {
- OrigTime--;
- textBox1.Text = OrigTime/60 + ":" + ((OrigTime % 60) >= 10 ? (OrigTime % 60).ToString() : "0" + OrigTime % 60);
- }
The code above is triggered when user click a button and will stop automatically.