# Directives

ON...GOSUB/GOTO/EVENT |

The ON directive has four formats: two that provide condition execution based on the value of a numeric expression, one that is used to define how to process EVENTS from OCX controls, and a fourth to define structured Error handling.

## Formats

Use these links to access additional information for a specific format:

Format | Description
ON numexpr GOSUB stmtref,... | Jump to a subroutine value based on the value of a numeric expression.
ON numexpr GOTO stmtref,... | Transfer control to a statement value based on the value of a numeric expression.
ON EVENT... | Control the processing of events as received from external controls. COM, .NET and *Browser controls are supported. See DEF OBJECT directive. (.NET support was added in PxPlus 2025.)
ON PROCESS EVENT... | Define the logic to be executed when a PROCESS EVENT directive is executed. (The PROCESS EVENT directive was added in PxPlus v11.00.)
... ON ERR directive(s)... | Define Error logic for GOSUB, WHILE, FOR, REPEAT and SELECT directives.