Original Post
I would like to use minutes as opposed to just 1000ms. How can I conver the ms to minutes? Or I mean have the ms converted to minutes for display. I guess I could just say 1000ms/60 and append the text "min." but I was curious for something better.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace FatigueTimer
{
public partial class Form1 : Form
{
static int cntr = 0;
Timer fatigueTimer = new Timer();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
fatigueTimer.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
cntr += 1;
label1.Text = cntr.ToString();
if (label1.Text == "1200")
{
MessageBox.Show("You must take a break!", "It's been 20 MINUTES!",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
cntr = 0;
}
}
private void label1_Click(object sender, EventArgs e)
{
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
timer1.Stop();
}
else
{
timer1.Start();
}
}
}
}