Skip to main content Skip to footer

Change a Control's Properties Through Code in Code-Based Section Reports

Background:

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+.

Steps to Complete:

  1. 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.

  2. 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.

  3. 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.

  4. 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!”;

  5. Finally, if we preview the report from the design tab, we will see that our changes have been made!

Christian Wirt