让function selectFromList()把dbgrid中所选行的所有值存在变量Res中并返回,且该方法可通用.
form1:
function selectFromList()把dbgrid中所选行的所有值存在变量Res中并返回,
form2:
调用form1的function selectFromList,并取出返回值Res中键为'cust'与'model'的值.
请问变量Res用数组,还是用TStrings,还是用一个对象比较好?
关键是想让function selectFromList()可以通用,其它form调用它时只需要参数改变.
function selectFromList()怎么写比较好?
例如:
class function TfrmSelect.SelectFromList(adt_from: TADODataSet;
out Rst: variant): Boolean;
var
Res: ?;
begin
Rst := Null;
with TfrmSelect.Create(Application) do
try
ds_select.DataSet := adt_from;
ds_select.DataSet.Active := True;
Result := ShowModal = mrOk;
if Result then
begin
//Res = ?
Rst := Res;
end;
finally
Free;
end;
end;