Count keys

RTRD

Member
Joined
Jan 25, 2012
Messages
10
Location
Oslo, Norway
Programming Experience
1-3
How can i count keys pressed within ex. 1 min? Or how do i count a spesific key?
 
Follow the Blog link in my signature and check out my post on Keyboard Events to learn how to detect keys and characters. If you want to count, you simply start with a variable containing zero and increment it by 1 each time you detect what you're looking for. If you want to count multiple keys/characters then you can use a Dictionary(Of Key, Integer) or Dictionary(Of Char, Integer).

As for timing, use a Stopwatch object. Call it's Start method when you want to begin timing and test its Elapsed property to see if time is up.
 
Back
Top