I'm using vb and I did a little test on the key press time (the time we press down a key until we release it). i did this, it works.
Next, i tried to count the time gap between 2 key press.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
Something like : Key up, stopwatch start. Next keydown, stopwatch stop.
i found out that the system can't make it start from keyup then go to keydown.
i tried this but it didn't work.
Anyone has idea how to do it?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
Thanks!!




Reply With Quote