Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
StopWatch? iN C#? I encountered a problem!
Quang Dinh Luong
Oct 22 2015 11:56 PM
393
Reply
As the subject, I am making a StopWatch. You know, to learn Timer!
Ok, here's my code:
(ms = 1, hour, min, second = 0)
private void timerDisplay_Tick(object sender, EventArgs e)
{
ms++;
if
(ms ==
10
)
{
sec++;
ms =
1
;
}
txtMilisecond.Text =
"."
+ ms;
if
(sec ==
60
)
{
min++;
sec =
0
;
}
txtSecond.Text =
""
+ sec;
if
(min ==
60
)
{
hour++;
min =
0
;
}
txtMinute.Text =
""
+ min;
txtHour.Text =
""
+ hour;
}
When I run this, it gets faster and faster than an usal watch!
Anyone knows the problem?
Thanks,
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Loosing focus during execution of multiple exe through code.
Problem for solution