I was hoping the following would work to separate a list of records with a ";" and terminate the last record with a "."
DataBand1
Source = "CollectionEvent"
Text component name = "Text1"
I get error messages using the following C# code in Before Print for Text component "Text1". Any help or advice appreciated.
private void DataBand1_BeforePrint(object sender, EventArgs e)
{
// Assuming that "CollectionEvent" is the name of your data source
var records = CollectionEvent.ToList();
var formattedRecords = "";
for (int i = 0; i < records.Count; i++)
{
formattedRecords += records.CalcFullName; // Using the CalcFullName field
if (i < records.Count - 1)
{
formattedRecords += "; ";
}
else
{
formattedRecords += ".";
}
}
// Assign the formatted string to the named text component
TextComponent1.Text = formattedRecords;
}
Help with before Print C# code
-
- Posts: 7333
- Joined: Tue Mar 20, 2018 5:34 am
Re: Help with before Print C# code
Hello,
Please send us a sample report with test data that reproduces the issue for analysis.
Thank you.
Please send us a sample report with test data that reproduces the issue for analysis.
Thank you.