I have a datamodule (TfDB) I wanted to add this function to it
Function GetZone(zone :string):string;
When i try to run it i get this error... Unsatisfied forward of external declaration : TfDB.GetZone
unit MyDataModule;
interface
uses
System.SysUtils, System.Classes, Data.DB, Data.Win.ADODB;
type
TfDB = class(TDataModule)
dbconnection: TADOConnection;
private
{ Private declarations }
public
Function GetZone(zone :string):string;
end;
var
fDB: TfDB;
implementation
{%CLASSGROUP 'System.Classes.TPersistent'}
{$R *.dfm}
Function GetZone(zone:string):string;
begin
if zone = 'FLayout1' then
result := '1';
if zone = 'FLayout2' then
result := '2';
if zone = 'FLayout3' then
result := '3';
if zone = 'FLayout4' then
result := '4' ;
if zone = 'FBoneYard' then
result := 'BoneYard';
if zone = 'FShop' then
result := 'shop';
if zone = 'FMisc' then
result := 'Misc' ;
end;
end.
In the implementation section you need to declare the function as being a method of the class:
function TfDB.GetZone(zone:string):string;
begin
....
end;
Your declaration looked like this:
function GetZone(zone:string):string;
begin
....
end;
And that defines a stand-alone function rather than a method of the class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With