ActiveReports 8
AddRange Method
See Also  Example
GrapeCity.ActiveReports.v8 Assembly > GrapeCity.ActiveReports.SectionReportModel Namespace > ControlCollection Class : AddRange Method

controls
An array of ARControl objects to add to the collection.

Glossary Item Box

Adds an array of ARControl objects to the collection.

Syntax

Visual Basic (Declaration) 
Public Sub AddRange( _
   ByVal controls() As ARControl _
) 
C# 
public void AddRange( 
   ARControl[] controls
)

Parameters

controls
An array of ARControl objects to add to the collection.

Remarks

The ARControl objects in the array are appended to the end of the collection.

Example

C#Copy Code
private void SectionReport1_ReportStart(object sender, System.EventArgs eArgs)
{
    //create an array of controls
    //array initialization is one-based, while array access is zero-based
    ARControl[] arr = new ARControl[3];
    GrapeCity.ActiveReports.SectionReportModel.CheckBox c = new GrapeCity.ActiveReports.SectionReportModel.CheckBox();
    GrapeCity.ActiveReports.SectionReportModel.Label l = new GrapeCity.ActiveReports.SectionReportModel.Label();
    GrapeCity.ActiveReports.SectionReportModel.TextBox t = new GrapeCity.ActiveReports.SectionReportModel.TextBox();
    //set some properties for the controls
    c.Text = "Checkbox";
    l.Left = 1;
    l.Value = "LabelValue";
    t.Left = 2;
    t.Text = "TextBox";
    //assign the controls to the array
    arr[0] = c;
    arr[1] = l;
    arr[2] = t;
    //add the range of controls to the first section of the report
    this.Sections[0].Controls.AddRange(arr);
}
Visual BasicCopy Code
Private Sub SectionReport1_ReportStart(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.ReportStart
    'create an array of controls
    Dim arr(2) As ARControl
    Dim c As New GrapeCity.ActiveReports.SectionReportModel.CheckBox
    Dim l As New GrapeCity.ActiveReports.SectionReportModel.Label
    Dim t As New GrapeCity.ActiveReports.SectionReportModel.TextBox
    'set some properties for the controls
    c.Text = "Checkbox"
    l.Left = 1
    l.Text = "Label"
    t.Left = 2
    t.Text = "TextBox"
    'assign the controls to the array
    arr(0) = c
    arr(1) = l
    arr(2) = t
    'add the range of controls to the first section of the report
    Me.Sections(0).Controls.AddRange(arr)
End Sub

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ControlCollection Class
ControlCollection Members
ActiveReports6~GrapeCity.ActiveReports.ControlCollection~Add