Object Reference > True DBGrid Events > KeyPress Event |
KeyPress Event
Occurs when an ANSI key is pressed and released.
object_KeyPress (KeyAscii As Integer)
Arguments
KeyAscii is an integer representing an ANSI key code. KeyAscii is passed by reference; changing it sends a different character to the grid. Changing KeyAscii to 0 cancels the keystroke so the grid receives no character.
The KeyPress event occurs when the user presses and releases one of the following kinds of keys:
· A printable keyboard character.
· The Ctrl key combined with an alphabetic or special character.
· The Enter or Backspace key.
Use the KeyPress event to test keystrokes for validity or to format characters as they are typed.