You can't use KeyPress as that only handles non-character key's such as Enter.

You'd have to do something similar to the below:

vbnet Code:
  1. Dim keypressed As Boolean
  2.  
  3.     Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles TextBox1.KeyDown
  4.         If keypressed = False Then
  5.             If e.KeyData = Keys.W Then
  6.                 MsgBox(TimeOfDay & " " & "Cough")
  7.                 keypressed = True
  8.             End If
  9.         End If
  10.  
  11.     End Sub
  12.  
  13.     Private Sub TextBox1_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
  14.         If e.KeyData = Keys.W Then
  15.             keypressed = False
  16.         End If
  17.     End Sub