Loading TDataModule returns 'There is no method in an ancestor class to be overridden "procedure LoadDFMValues of Object"'

Im trying to load a TDataModule component that I have put some helper functions for my application.

Its giving me this error: '[Error] Help.pas(16): There is no method in an ancestor class to be overridden "procedure LoadDFMValues of Object"'

and this is my file:

unit Help;

interface

uses
  System.SysUtils, System.Classes, WEBLib.CDS, WEBLib.Cookies;

type
  TDataModule1 = class(TDataModule)

  private
    { Private declarations }
  public
    procedure setBearerHeaderr(requestRef: TWebClientConnection);
    function GetCookiee(cookie_name: string): string;
  end;

var
  DataModule1: TDataModule1;

implementation

{%CLASSGROUP 'Vcl.Controls.TControl'}

{$R *.dfm}
procedure TDataModule1.setBearerHeaderr(requestRef: TWebClientConnection);
begin
requestRef.Headers.AddPair('authorization', 'Bearer ' + GetCookiee('bearer'));
end;
function TDataModule1.GetCookiee(cookie_name: string): string;
var
  Cookies: TCookies;
  Cookie: TCookie;
begin
  Result := '';
  Cookies := TCookies.Create;
  try
    Cookies.GetCookies;
    Cookie := Cookies.Find(cookie_name);
    if Assigned(Cookie) then
      Result := Cookie.Value;
  finally
    Cookies.Free;
  end;
end;

end.

I cannot see an issue when descending from the correct TWebDataModule instead of TDataModule:


type
  TDataModule1 = class(TWebDataModule)
  private
    { Private declarations }
  public
    { Public declarations }
    procedure setBearerHeaderr(requestRef: TWebClientConnection);
    function GetCookiee(cookie_name: string): string;
  end;

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.