CREATE Subreports Dynamically at Runtime
Hi, Does anybody know how to dynamically create + Load Sub Reports at
runtime. I have created a small sampler to try and perform this but I get an
exception upon loading the main report (this only happens after I assign the
subreport to the band in either of the prescribed ways)
Ctrl:=TppSubReport.Create(Designer);
etc....
Band.AddObject(Ctrl);
or
Ctrl.Band:=Band;
Also in a similar vein can anyone tell me why when dynamically creating
controls at runtime I have to perform the last line of code in order to
prevent an exception upon loading the report (all the controls appear fine!)
Incidentally I have tried this with the above code and it doesn't solve my
problems.
Ctrl:=TppLabel.Create(Designer);
etc
Band.AddObject(Ctrl);
Band.RemoveObject(Ctrl);
Any help would be most welcome
Regards
Conrad Rowlands
Callards Technology Ltd
runtime. I have created a small sampler to try and perform this but I get an
exception upon loading the main report (this only happens after I assign the
subreport to the band in either of the prescribed ways)
Ctrl:=TppSubReport.Create(Designer);
etc....
Band.AddObject(Ctrl);
or
Ctrl.Band:=Band;
Also in a similar vein can anyone tell me why when dynamically creating
controls at runtime I have to perform the last line of code in order to
prevent an exception upon loading the report (all the controls appear fine!)
Incidentally I have tried this with the above code and it doesn't solve my
problems.
Ctrl:=TppLabel.Create(Designer);
etc
Band.AddObject(Ctrl);
Band.RemoveObject(Ctrl);
Any help would be most welcome
Regards
Conrad Rowlands
Callards Technology Ltd
This discussion has been closed.
Comments
excellent technical tips section contained an example I would have looked
there. Doh. As for the second question I would still like to know........
--
Regards
Conrad Rowlands
Callards Technology Ltd
bands need to "own" the controls so that when the report is freed, the bands
get freed and the bands free the controls that are in them.
Ctrl.Band := Report.Detail
Here is the link to the example:
http://www.digital-metaphors.com/tips/DynamicSubreportCreation.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com