How to save time Interval before is ends?
Hello!
I have Form with a Timer1, and it set to 10Sec.
There is a KeyDown event - when the user press "Enter", I would like to save in "ans" the time duration that past in the 10S interval before it ends.
For Example: If i starting the timer1 now, and after 3Sec, I'm pressing Enter, ans = 3. and if I didnt press any key, ans will be equal to 10.
I have this code:
if (e.KeyCode == Keys.Enter)
{
ResponseTimeList.Add(timer1.Interval);
}
*ResponseTimeList is:
public List<double> ResponseTimeList = new List<double>();
How can i improve it?
Thanks.