In this article, we will discuss how to change control properties of code-based section reports at run-time through code in Visual Studio 2019. This article assumes that you are using a basic WinForm application within .NET Framework. This applies to AR14+.
Double click the report in the solution explorer to open the section report designer. Here, we can open the AR15 toolbox (or the version you’re using), and drag a control into the “detail” section of the report. Let’s use a TextBox for this example.
After dragging the control onto the report, click the “detail” header on the report designer to open the properties tab, then click the lightning bolt icon in the bottom right of Visual Studio to see the events page.
Here we can create an event that will be responsible for changing the control properties. If we double click “BeforeLoad”, the report will create an event handler and attach it automatically.
In the code-behind of the section report, we will see the event handler. Within this event, let’s select the control (by name) that we want to edit. Ex: this.TextBox1.Text = “Text Has Changed!”;
Finally, if we preview the report from the design tab, we will see that our changes have been made!