Pocket PC Countdown Timer

viper2843

Newcomer
Joined
Aug 3, 2003
Messages
9
I am trying to create a countdown clock for my Pocket PC and I have to working for the most part but the timer is very unreliable and I can't figure out why. It goes very fast for some reason. It went from a 1 minute countdown in about 16 seconds. Can anyone help me? I have included the code.
 

Attachments

Last edited by a moderator:
Interval = Milleseconds

I put in 60 and got the timer event hitting every 60 milleseconds, when you apply the timer.Interval value you want it to be tripping very second yea?
Then it should be done like this.....

private int seconds = 60;

private void SomeBeginningMethod()
{
Timer t = new Timer();
t.Interval = 1000;//takes a milleseconds value
t.Tick+=new EventHandler(t_Tick);
t.Enabled = true;
}
private void t_Tick(object sender, System.EventArgs e)
{
seconds--;
if(seconds<1)
{
MessageBox.Show("Out of seconds");
Timer t = (Timer)sender;
t.Enabled = false;
t.Dispose();
}
}
 
Back
Top