# KeyPress Event

> Occurs when the user presses and releases an ANSI key in the TXTextControl; passes the ANSI key code, and changing it sends a different character.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Event
- **Path:** TX Text Control ActiveX > API Reference > TXTextControl > KeyPress Event
- **170 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/keypress-event/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/keypress-event/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/keypress-event/llms-full.txt

---

Occurs when the user presses and releases an ANSI key while the Text Control has the input focus.

### Syntax

```vbscript
KeyPress(KeyAscii)
```

### Parameters

| Parameter | Description |
|---|---|
| KeyAscii | Is a standard numeric ANSI keycode. Changing it sends a different character to the Text Control. |

### Data Types

| Name | Data type |
|---|---|
| KeyAscii | Integer |

### See Also

- [KeyDown Event](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/keydown-event/llms-full.txt)
- [KeyUp Event](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/keyup-event/llms-full.txt)
- [Programming Category: Text Selections and Character Input](https://docs.textcontrol.com/tx-text-control-activex/reference/categories/selections/llms-full.txt)

---

## Nearby

- **Previous:** [KeyDown Event](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/keydown-event/llms-full.txt)
- **Next:** [KeyStateChange Event](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/keystatechange-event/llms-full.txt)
