Click here to Skip to main content
15,913,361 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
i have an internet cafe so i want to create a timer for the shop.

this is my code and please can you help me on how to get the amount per hour or to compute for it. can you help me to have a better way on how to compute the amount in every 3minutes

thank you for the help...

C#
private void timer_pc2_Tick(object sender, EventArgs e)
      {//to get the amount in every 3 minutes
          count_pc2 += 1;
          if (count_pc2 == 1800)
          {
              amount_pc2 += 1;
              lblamount_pc2.Text = "P" + " " + (amount_pc2.ToString()) + ".00";
              count_pc2 = 1640;
          }
          //count time
          diffA[2] = DateTime.Now - startTime[2];
          diffB[2] = new TimeSpan(diffA[2].Hours, diffA[2].Minutes, diffA[2].Seconds);
          this.lbltime_pc2.Text = (diffB[2].ToString());
          if (this.lbltime_pc2.Text == diff[2].ToString())
          {
              this.timer_pc2.Enabled = false;
              endTime[2] = DateTime.Now.AddMinutes(0);
          }
      }
Posted
Updated 7-Mar-10 22:43pm
v4

1 solution

int minutesPerHour = 60;
int secondsPerMinute = 60;
TicksPerHour = minutesPerHour * secondsPerMinute * yourTimer.Interval / 1000;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900