I’m trying to replace some text in a Report’s Labels automatically, without knowing the name of the object in advance.
Windows are easy with ControlCount and Control(), but those don’t exist on reports.
Using Introspection & GetProperties I can walk through the report elements, and I can identify ReportLabels.
However, I can’t figure out how to access the Text property of the label.
With p as Propertyinfo that contains one of the report elements,
I’ve tried:
if p.PropertyType.Name="ReportLabel" then
dim l, lr As ReportLabel
l = p.Value(lr) // result: project just stops
l.Text = "Something"
end if
or
if p.PropertyType.Name="ReportLabel" then
dim l, lr As ReportLabel
lr = new ReportLabel("temp")
l = p.Value(lr) // result: l=Nil
l.Text = "Something" // NilObjectException
end if