Gambas Documentation
Documents

STOP EVENT

STOP EVENT

This statement must be used in an event handler. It tells the interpreter that the event that called the event handler must be cancelled.

Only a few native events can be cancelled. This is primarily intended to allow you to supersede default keyboard and mouse behavior with a different behavior of your choice.

Example

' My text box only accepts digits

Public Sub MyTextBox_KeyPress()

  If Instr("0123456789", Key.Text) = 0 Then
    Stop event
  Endif

End Sub

See also