net_ved
یک شنبه 23 دی 1386, 11:14 صبح
من این کدرو نوشتم ... برای اشیاء بصری کار می کنه ولی برای اشیا غیر بصری کار نمی کنه ... در واقع توابع FindComponent , FindGlobalComponent روی اشیا غیر بصری که Create شده اند جواب نمی ده ... مشکل کجاست ؟
procedure TForm1.Button2Click(Sender: TObject);
var DS:TDataSource;
begin
if TDataSource(FindComponent('DS1'))<>nil then
begin
TDataSource(FindGlobalComponent('DS1')).Destroy;
end
DS:=TDataSource.Create(Application);
DS.DataSet:=ADOTable1;
DS.Name:='DS1';
end;
procedure TForm1.Button2Click(Sender: TObject);
var DS:TDataSource;
begin
if TDataSource(FindComponent('DS1'))<>nil then
begin
TDataSource(FindGlobalComponent('DS1')).Destroy;
end
DS:=TDataSource.Create(Application);
DS.DataSet:=ADOTable1;
DS.Name:='DS1';
end;