{函数1,报错}
procedure getField(twc : TDataLink; Lb:TLabel);
begin
TDataLink(twc).DataField := TLabel(lb).Caption;
end;
{函数2.1}
procedure getField(twc : TDBEdit; Lb:TLabel); overload;
begin
TDBEdit(twc).DataField := TLabel(lb).Caption;
end;
{函数2.2}
procedure getField(twc : TDBComboBox; Lb:TLabel); overload;
begin
TDBComboBox(twc).DataField := TLabel(lb).Caption;
end;
{调用}
getField(Form1.DBComboBox1, Form1.Label11);
方法2如何合并为方法1?
procedure getField(twc : TDataLink; Lb:TLabel);
begin
TDataLink(twc).DataField := TLabel(lb).Caption;
end;
{函数2.1}
procedure getField(twc : TDBEdit; Lb:TLabel); overload;
begin
TDBEdit(twc).DataField := TLabel(lb).Caption;
end;
{函数2.2}
procedure getField(twc : TDBComboBox; Lb:TLabel); overload;
begin
TDBComboBox(twc).DataField := TLabel(lb).Caption;
end;
{调用}
getField(Form1.DBComboBox1, Form1.Label11);
方法2如何合并为方法1?