Delphi Compiler Error
E2168 Field or method identifier expected
Reason for the Error & Solution
You have specified an identifier for a read or write clause to a property which is not a field or method.
program Produce;
var
r : string;
type
Base = class
t : string;
property Title : string read Title write Title;
property Caption : string read r write r;
end;
begin
end.
The two properties in this code both cause errors. The first causes an error because it is not possible to specify the property itself as the read & write methods. The second causes an error because ‘r’ is not a member of the Base class.
program Solve;
type
Base = class
t : string;
property Title : string read t write t;
end;
begin
end.
To solve this error, make sure that all read & write clauses for properties specify a valid field or method identifier that is a member of the class which owns the property.