KeyPress Event  
 

The KeyPress event is generated when a key is pressed and released.

Syntax

Sub object_KeyPress( [Index As Integer], KeyAscii As Integer )

Remarks

The KeyPress event is generated when the user presses and releases key on the keyboard. The following arguments are passed to the event handler:

KeyAscii
An integer which specifies the standard ASCII value of the key that was pressed. In Visual Basic, you can convert the key value into a character by using the Chr function.

Example

The following example demonstrates how to use the KeyPress event in conjunction with the SendKey method in the Telnet control:

Private Sub Terminal1_KeyPress(KeyAscii As Integer)
    TelnetClient1.SendKey KeyAscii
End Sub

See Also

KeyDown Event, KeyMapped Event, KeyUp Event