This query returns a Long value, indicating the state of the event task.
1: Running (TASK_RUNNING)
2: Stopped due to IDLETASK or after a STEPIN instruction (TASK_STOPPED)
4. Stopped due to runtime error (TASK_ERROR)
Returned value: 1, 2, 4
Task or Terminal
Event must be loaded in memory(after the execution of the OnEvent statement and while calling task is running).
If Event1.State = TASK_ERROR Then
‘Check if event is stopped due to run-time error