I keep getting this error. On FGetZoneData
I have:
var
SelectedDept: String;
implementation
procedure TFGetZoneDept.GetClick1(Sender: TObject);
var
azone: string;
adept: string;
bstats,
bname,
btop,
bleft,
bnumber,
basset: string;
machine : TMachine;
begin
fdb.count := 0; //keeps track of number of machines in zone
azone := Combobox1.Text; //gets name of zone
adept := TfDB.GetDeptDBName(SelectedDept); //gets name of dept from a function
fdeptlayout.ListBox1.Clear;
end;
and on TFdB
I have a function declared in public:
public
Function GetDeptDBName(name :string):String;
end;
Any idea why this would not work?
You're calling the method on a class (I assume TfDB
is a class name) not on an instance. Only class methods can be called that way. What you have to do is to create an instance, then call the method on it:
var DB: TfDB;
begin
DB := TfDB.Create(); // create an instance
adept := DB.GetDeptDBName(SelectedDept); // call the method
See the E2076 This form of method call only allowed for class methods topic in docwiki.
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