|
-
Jun 21st, 2008, 04:54 AM
#1
Thread Starter
Member
Need some help here~~
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.
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
Next, i tried to count the time gap between 2 key press.
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.
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
Anyone has idea how to do it?
Thanks!!
-
Jun 27th, 2008, 03:44 AM
#2
Re: Need some help here~~
Hi Rachel,
You really need this one in the VB.Net forum so more people can see this and help you.
What is your end goal with this, what are you trying to accomplish with your program here please?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|