You can access static fields without creating a class instance. Non-static fields are available only for a class instance. When a non-static field is accessed from a static method, the instance of this class is not yet initialized, therefore the value of the non-static field cannot be changed.
Delete the reference to non-static fields from the static methods. You may need to declare these fields as static.
Class MyClass: Object
i: Integer;
Shared Sub UserProc;
Begin
i := 100;
End Sub UserProc;
End Class MyClass;
When the specified code is compiled, the string i := 100; displays the following error: Non-static field cannot be accessed from static method. To resolve the error, add the Shared directive for the "i' variable or delete this directive from the header of the UserProc procedure.
See also: