Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
'Start the first stopWatch.
sw1.Start()
End Sub
Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
'Turn off the first stopWatch.
sw1.Stop()
sec = sw1.ElapsedMilliseconds
End Sub
this code actually work to count the time u pressing a key
when key down the stopwatch starts, when key up it stops.
Now, i try to start the stopwatch at 'key up' and stop at 'the next key down' (to count the time from key release till the next key being press)
i added a counter that looks like this:
Code:
dim counter_one as integer=0
dim counter_two as integer=0
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
counter_two +=1
if counter_two>=2 then
sw1.stop()
sec = sw1.ElapsedMilliseconds
end if
End Sub
Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
counter_one +=1
if counter_one>=1 then
sw1.start()
end if
End Sub
but this doesn't work
..anyone knows why?