How can I free this OBJECT?
This procedure create a dataView and at first time I run it and works fine
but if I run it next time it gives me an error
"A Componant named daBDEQueryDataView1 already exists in at <>
owned by TAppplication."
I couldn't able to find this component and making it nil any help on this
one?
-Bhoj
procedure TfrmQueryWizard.CreateDataViews;
var
FDataSettings: TppDataSettings;
Temp : TComponent;
begin
DeleteDataModule;
FreeObject(lDataView); //Make sure it must be free else you will get an
error message
FreeObject(lDataModule);
lDataModule := daGetDataModule( fReport);
if lDataModule = nil then begin
lDataModule := TdaDataModule.CreateForReport(fReport);
end;
lDataModule.FreeNotification( self);
lDataView := TdaBDEQueryDataView.Create(lDataModule);
lDataView.FreeNotification( self);
lDataView.Parent := lDataModule; //I can go up to here and got an error
when it try to assign a Parent ???
lDataView.Init;
end;
but if I run it next time it gives me an error
"A Componant named daBDEQueryDataView1 already exists in at <>
owned by TAppplication."
I couldn't able to find this component and making it nil any help on this
one?
-Bhoj
procedure TfrmQueryWizard.CreateDataViews;
var
FDataSettings: TppDataSettings;
Temp : TComponent;
begin
DeleteDataModule;
FreeObject(lDataView); //Make sure it must be free else you will get an
error message
FreeObject(lDataModule);
lDataModule := daGetDataModule( fReport);
if lDataModule = nil then begin
lDataModule := TdaDataModule.CreateForReport(fReport);
end;
lDataModule.FreeNotification( self);
lDataView := TdaBDEQueryDataView.Create(lDataModule);
lDataView.FreeNotification( self);
lDataView.Parent := lDataModule; //I can go up to here and got an error
when it try to assign a Parent ???
lDataView.Init;
end;
This discussion has been closed.
Comments
work.The data module is owned by the form, and the dataviews are owned by
the form, so they will be freed when the form is freed, unless you free them
manually. You have to give the dataviews unique names in order to add the
next dataview.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
how do I give it a uniqueName? Do you have any code sample to use your
GetUniqueName function?
Can you make my example current by using your GetUniqueName?
Thank you
-Bhoj
prefix you want, ie. 'my' and finally pass the component reference.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com