Compiler Error C0045
Message: Use of 'THIS' is not allowed in this context
Possible error cause: In order to be assigned to the current instance, THIS can be used only in a method, action, transition, or in the body of a function block. This error message appears for all other positions.
Error correction: Use THIS in an allowed context only.
Example 344. Example of the error:
PROGRAM PLC_PRG VAR test1: INT; END_VAR THIS^.test1 := 19;
Message:
C0018: 'THIS^.test1' is no valid assignment target
C0062: 'THIS^' is no structure variable
Use of 'THIS' is not allowed in this context