# How to make a timer?

Lol I s****camping 3 times already done all OK and now the head does not cook...

need help --
initialized variables with the top ==

``````Seconds = 0;
Minutes = 0;
Hour = 0;``````

``````private void timer1_Tick(object sender, EventArgs e)
{
Seconds++;
label9.Text = Convert.ToString(Seconds);

if (Seconds == 2)
{
Minutes++;
label16.Text = Convert.ToString(Minutes);
label9.Text = "0";
}
if (Minutes == 2)
{
Hour++;
label17.Text = Convert.ToString(Hour);
label16.Text = "0";
}
}``````

The problem is that when the moment comes to 2 minutes + 1 sec reset BUT after seconds tick start with 0 and the numbers kotoroy they're cleared ( ie h == 2 ) min + 1 and sec 0 sec TICK and started with 0 and with 3
April 19th 20 at 12:44
April 19th 20 at 12:46
Solution
Teak, cleared, and then min == 1. When will the tick, the sec will be ==2,i.e. == 2,then zero.
Yes, I have learned to understand the ancient language. Where reset it? Variable do not affect the same
in General, I have solved this problem )
thanks for trying to understand and help XA () - jackson.Waelc commented on April 19th 20 at 12:49
@jackson.Waelccan easier, there is a DateTime class, when you start memorize the current time and when you stop or tick of the timer, get current time and you will have how much time passed from the start to now. - hattie.Hills commented on April 19th 20 at 12:52

Find more questions by tags C#