This Form of method call only allowed for class methods error

后端 未结 1 1139
暗喜
暗喜 2021-01-18 08:56

I keep getting this error. On FGetZoneData I have:

var
   SelectedDept: String;

implementation

procedure TFGetZoneDept.GetClick1(Sender: TObje         


        
相关标签:
1条回答
  • 2021-01-18 09:10

    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.

    0 讨论(0)
提交回复
热议问题