Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

How to create a Simple StopWatch

This is good to use on timers when auto refreshing web pages etc. Good share man.
(Sep 7, 2015 03:43 AM)BahNahNah Wrote:  Or just use a timer? 🤮

You could use both. Have the stopwatch counting inside the timer. 🙂

Code
using System.Diagnostics;

Stopwatch Stopwatch = new Stopwatch();

// add to button1 click
Stopwatch.Reset();
Stopwatch.Start();
timer1.Start();

// add to timer1 tick
if(Stopwatch.Elapsed.Seconds == 10)
{
    // Do something after 10 second mark is reached
}


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by deadsh0tJun 12, 2019 06:27 AM 0 115 Jun 12, 2019 06:27 AM
Last Post: deadsh0t
[.NET] by webwarlock72May 30, 2015 03:39 PM 4 117 May 30, 2015 03:39 PM
Last Post: paquiton96
[.NET] by CodeBinaryJan 2, 2015 06:39 PM 5 261 Jan 2, 2015 06:39 PM
Last Post: +Haze