c# - DateTime + Timer Tick? -


i want, when click on button, start "elapsed time". i've written far:

private void timer_tick(object sender, eventargs e) {     timecounter++;     labeltimer.text = "elapsed time: " + timecounter.tostring(); } 

with timer interval @ 1000 (1 second).

what want format time this:

hh:mm:ss 

and auto increment minutes when seconds reach 60, , on hours. should use datetime , add second every 1 second?

you may use timespan:

timespan _elapsed = new timespan();  private void timer_tick(object sender, eventargs e) {     _elapsed = _elapsed.add(timespan.fromminutes(1));     labeltimer.text = "elapsed time: " + _elapsed.tostring(); } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -