Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)
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.

LaundryTimer.zip

Edited by PlausiblyDamp
  • 3 weeks later...
Posted

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();

}

}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...