比如每个窗口中同一按钮的添加文件代码都是相同的,比如删除代码如下
if ADOquery1.IsEmpty then exit;
if not MsgBoxSel_save('确认要删除? ') then exit;
ADOquery1.Delete;
try
ADOQuery1.UpdateBatch;
except
ADOQuery1.CancelUpdates;
MsgBoxInfo('已使用不能删除。 ');
exit;
end;
如何在public.pas中写个公共文件供子文件调用
有人提出可以用寄存
有顶部use中包含U_public,
type
TFrm_bargain = class(Tpublic)
不懂???
if ADOquery1.IsEmpty then exit;
if not MsgBoxSel_save('确认要删除? ') then exit;
ADOquery1.Delete;
try
ADOQuery1.UpdateBatch;
except
ADOQuery1.CancelUpdates;
MsgBoxInfo('已使用不能删除。 ');
exit;
end;
如何在public.pas中写个公共文件供子文件调用
有人提出可以用寄存
有顶部use中包含U_public,
type
TFrm_bargain = class(Tpublic)
不懂???
procedure Delete(FADOQuery: TADOQuery)
begin
if FADOQuery.IsEmpty then exit;
if not MsgBoxSel_save('确认要删除? ') then exit;
FADOQuery.Delete;
try
FADOQuery.UpdateBatch;
except
FADOQuery.CancelUpdates;
MsgBoxInfo('已使用不能删除。 ');
exit;
end;
end;
然后引用U_public, 调用 Delete(ADOQuery1)
比如本单元 bm.pas里
有顶部use中加U_public,
type
TFrm_bargain = class(Tpublic),
public是基类窗体,有和bm.pas一样的包含添加,删除,修改,审核之类的按钮,bm.pas中也有这些按钮,打开的时候说按钮已存在,哪错了呀