Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. restarting second counter

restarting second counter

Scheduled Pinned Locked Moved C#
helptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jason Ranin
    wrote on last edited by
    #1

    hi, i have a counter that counts down from 5 minutes. i have 2 separate displays: 1. minute display(which counts down every 60 seconds), 2. seconds display(which counts down from a minute i.e. 00, 59, 58 ....). what i cant figure out is how to make the second counter to restart at 00 after a minute has gone by. can anyone help me? thanks. Sincerely, Jason C. Ranin Software Quality Assurance

    C 1 Reply Last reply
    0
    • J Jason Ranin

      hi, i have a counter that counts down from 5 minutes. i have 2 separate displays: 1. minute display(which counts down every 60 seconds), 2. seconds display(which counts down from a minute i.e. 00, 59, 58 ....). what i cant figure out is how to make the second counter to restart at 00 after a minute has gone by. can anyone help me? thanks. Sincerely, Jason C. Ranin Software Quality Assurance

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Why do you need two counters? Why not just have one counter counting the seconds? Assuming your counter variable is called counter, each time the timer fires you increment it. To get the seconds and minutes try:

      int seconds = counter % 60;
      int minutes = counter / 60;


      "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar The Second EuroCPian Event will be in Brussels on the 4th of September Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way! My Blog

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups