18
Take a look at Microsoft's MultiPoint SDK
(edit: this answer is no longer applicable now that the question has been clarified. i'm leaving it here for others to discover though)
Try:
Dim PreviousKeyPressTime As DateTime = Nothing
Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
PreviousKeyPressTime = Nothing
TextBox1.Text = String.Empty
Else
If PreviousKeyPressTime = Nothing Then
PreviousKeyPressTime = DateTime.Now
End If
Dim startTime As DateTime = Now
Dim runLength As Global.System.TimeSpan = startTime.Subtract(CType(Me.PreviousKeyPressTime, DateTime))
Dim millisecs As Integer = runLength.Milliseconds
Dim secs As Integer = runLength.Seconds
Dim TotalMiliSecs As Integer = ((secs * 1000) + millisecs)
lblDiff.Text = TotalMiliSecs
If TotalMiliSecs <= 50 Then
lblMsg.Text = String.Empty
Else
lblMsg.Text = "keyboard Input not Allow"
End If
PreviousKeyPressTime = DateTime.Now
End If
End Sub
Source : http://itlearnerinsect.blogspot.com/