Posted 2 August 2019, 11:18 am EST
This seems like a really simple issue but I’ve had no success in figuring it out.
We’re converting from an older version of C1Reports to use FlexReports, and I’ve been going through and updating most of our code that was populating the report. Assigning regular text to a field is not an issue, assigning the datasource (retrieved from a service call and put into a datatable) is not an issue. However, when trying to assign a column from the datatable to a field in the Detail section of the report, I cannot get it to work. The old code, for the C1Report, looked like this:
objdocument.Fields("fldItem").Text = "[ITEM_DESC]"
The updated code I was trying to use looks like this:
Dim newItemDescText As C1.Win.FlexReport.TextField = DirectCast(objdocument.Fields("fldItem"), C1.Win.FlexReport.TextField)
newItemDescText.Text = "[ITEM_DESC]"
If I leave the report field as a Field object, the code above works fine. When trying to be specific to the TextField object type, it does not. It just posts [ITEM_DESC] for as many rows that are in the datatable. I found another post on the forum where it was said to make sure to set the column name to the Text property of the TexTfield object, but I haven’t been able to find a code sample showing the format for doing that. Every FlexReport sample I find seems to use a datasource accessing the database directly, which is not an option for us.
What am I doing wrong? Should I be using a different object type instead of the TextField? It looked like the Field object type was considered as a legacy type now, so I was trying to use something like the TextField object. Thanks for any help you can offer.
