Visual Basic  Glossary

 
KeyAscii Returns the ASCII values. It is the argument contains in a KeyPress sub procedure. It is also used with chr$ to convert an ASCII value to a string.               
KeyCode The parameter which contains an ASCII value representing the key pressed by the user. To test for which letter key is being pressed, you can use the following procedure:

Private Sub Form_keyDown(KeyCode As Integer, shift As Integer)
If KeyCode >= vbKeyA And KeyCode <= vbKeyZ Then
Print Chr(KeyCode)
End If
End Sub

* The function Chr will display the character corresponding to a ASCII code

KeyDown The event procedure when a key is pressed      (Example: refer to the example above)
KeyPress The event procedure when a key is pressed
KeyUp The event procedure when a pressed key  is released

 

 

  [Back to VB Glossary]