Delphi Error – E2274 property attribute ‘label’ cannot be used in dispinterface

Delphi Compiler Error

E2274 property attribute ‘label’ cannot be used in dispinterface

Reason for the Error & Solution

You have added a label to a property defined in a dispinterface, but this is disallowed by the language definition.

program Problem;

  type
    T0 = dispinterface
      ['{15101510-1510-1510-1510-151015101510}']
      function R : Integer;
      property value : Integer label 'Key';
    end;

begin
end.

Here an attempt is made to use a label attribute on a dispinterface property.

program Solve;

  type
    T0 = dispinterface
      ['{15101510-1510-1510-1510-151015101510}']
      function R : Integer;
      property value : Integer;
    end;

begin
end.


The only solution to this problem is to remove label attribute from the property definition.