So after letting it run for an hour, the timer seemed to be about 4 minutes too fast (i.e. after letting it count down for an hour, it finished about 4 minutes too quickly).
I'm thinking it's in my _Tick method. I know there's an issue with the milliseconds, but I think there might be a bigger issue.
Here's the tick method and some other info....any idea what I'm doing wrong here?
Code:this.timer1.Interval = 10; this.timer1.Tick += new System.EventHandler(this.timer1_Tick);Code:private void timer1_Tick(object sender, EventArgs e) { // Verify if the time didn't pass. if ((minutes == 0) && (hours == 0) && (seconds == 0) && (millisec == 0)) { // If the time is over, clear all settings and fields. // Also, show the message, notifying that the time is over. timer1.Enabled = false; //MessageBox.Show(textBox4.Text); button1.Enabled = false; button3.Enabled = false; button2.Enabled = true; textBox3.Clear(); textBox2.Clear(); textBox1.Enabled = true; textBox3.Enabled = true; textBox2.Enabled = true; textBox1.Enabled = true; } else { // Else continue counting. if (millisec < 1) { millisec = 59; if (seconds < 1) { seconds = 59; if (minutes == 0) { minutes = 59; if (hours != 0) hours -= 1; } else { minutes -= 1; } } else seconds -= 1; } else millisec -= 1; // Display the current values of hours, minutes and seconds in // the corresponding fields. char pad = '0'; currentTime.Text = hours.ToString().PadLeft(2, pad) + " : " + minutes.ToString().PadLeft(2, pad) + " : " + seconds.ToString().PadLeft(2, pad) + " . " + millisec.ToString().PadLeft(2, pad); } }




Reply With Quote