In ActiveReports Professional Edition, you can set up a custom end-user report designer on a Windows form. When designing a report in the end-user report designer, you can add a section or an ActiveReports control to a report, remove it from a report and modify the properties of the ActiveReports report, section and control classes in code-behind, thus making the changes undoable. This means that you can undo at run time any modification you have made to an ActiveReports report, section or control property in code-behind.
- Add the Button control to the Design view of EndUserDesignerMainForm.
- Add code to the button_Click event to add a section (for example, the ReportHeader and ReportFooter section).
To write the code in Visual Basic Paste INSIDE the button_Click event
Copy CodeMe.arDesigner.ExecuteAction(DesignerAction.InsertReportHF)
Paste INSIDE the button_Click event
Copy Codethis.arDesigner.ExecuteAction(DesignerAction.InsertReportHF);
To add an ActiveReports control to the section
- Add the Button control to the Design view of EndUserDesignerMainForm.
- Add code to the button_Click event to add an ActiveReports control (for example, the TextBox control).
To write the code in Visual Basic Paste INSIDE the button_Click event
Copy CodeDim control As New TextBox control.Name = "TextBox1" control.Size = New SizeF(1.0F, 1.0F) Me.arDesigner.AddComponent(Me.arDesigner.Report.Sections("Detail1"), control)Paste INSIDE the button_Click event
Copy CodeTextBox control = new TextBox(); control.Name="TextBox1"; control.Size = new SizeF(1f,1f); this.arDesigner.AddComponent(this.arDesigner.Report.Sections["Detail1"], control);
To add an ActiveReports control to the section at the specified index
- Add the Button control to the Design view of EndUserDesignerMainForm.
- Add code to the button_Click event to add an ActiveReports control (for example, the TextBox control).
To write the code in Visual Basic Paste INSIDE the button_Click event
Copy CodeDim control As New TextBox control.Name = "TextBox1" control.Size = New SizeF(1.0F, 1.0F) Me.arDesigner.AddComponent(Me.arDesigner.Report.Sections("Detail1"), control, 0)Paste INSIDE the button_Click event
Copy CodeTextBox control = new TextBox(); control.Name="TextBox1"; control.Size = new SizeF(1f,1f); this.arDesigner.AddComponent(this.arDesigner.Report.Sections["Detail1"], control, 0);
- Add the Button control to the Design view of EndUserDesignerMainForm.
- Add code to the button_Click event to remove a section (for example, the PageHeader section).
To write the code in Visual Basic Paste INSIDE the button_Click event
Copy CodeMe.arDesigner.RemoveComponent(Me.arDesigner.Report.Sections("PageHeader1")) Paste INSIDE the button_Click event
Copy Codethis.arDesigner.RemoveComponent(this.arDesigner.Report.Sections["PageHeader1"]);
To remove an ActiveReports control
- Add the Button control to the Design view of EndUserDesignerMainForm.
- Add code to the button_Click event to remove an ActiveReports control (for example, the TextBox control).
To write the code in Visual Basic Paste INSIDE the button_Click event
Copy CodeMe.arDesigner.RemoveComponent(Me.arDesigner.Report.Sections("Detail1").Controls("TextBox1")) Paste INSIDE the button_Click event
Copy Codethis.arDesigner.RemoveComponent(this.arDesigner.Report.Sections["Detail1"].Controls[("TextBox1"]);
- Add the Button control to the Design view of EndUserDesignerMainForm.
- Add code to the button_Click event of a report to change a report property (for example, the PrintWidth property).
To write the code in Visual Basic Paste INSIDE the button_Click event
Copy CodeMe.arDesigner.UpdateComponent(Me.arDesigner.Report, "PrintWidth", 2.0F)
Paste INSIDE the button_Click event
Copy Codethis.arDesigner.UpdateComponent(this.arDesigner.Report, "PrintWidth", 2.0f);
- Add the Button control to the Design view of EndUserDesignerMainForm.
- Add code to the button_Click event of a report to change a section property (for example, the Height property).
To write the code in Visual Basic Paste INSIDE the button_Click event
Copy CodeMe.arDesigner.UpdateComponent (Me.arDesigner.Report.Sections("Detail1"), "Height", 10.0F)Paste INSIDE the button_Click event
Copy Codethis.arDesigner.UpdateComponent(this.arDesigner.Report.Sections["Detail1"],"Height", 10.0f);
To change an ActiveReports control property
- Add the Button control to the Design view of EndUserDesignerMainForm.
- Add code to the button_Click event to change a control property (for example, the Text property).
To write the code in Visual Basic Paste INSIDE the button_Click event
Copy CodeMe.arDesigner.UpdateComponent(Me.arDesigner.Report.Sections("Detail1").Controls("TextBox1"), "Text", "Test")Paste INSIDE the button_Click event
Copy Codethis.arDesigner.UpdateComponent(this.arDesigner.Report.Sections["Detail1"].Controls["TextBox1"], "Text", "Test");