Use the
StopWatch
[
^] class.
Stopwatch stopwatch = new Stopwatch();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
stopwatch.Start();
}
private void button2_Click(object sender, EventArgs e)
{
stopwatch.Stop();
var milliSeocnds = stopwatch.ElapsedMilliseconds;
MessageBox.Show(millSeconds + "milliseconds passed between the two clicks.");
}