ActiveReports3 Request technical support
Remove Method
See Also  Example


Removes a Section from the SectionCollection.
Removes a section from the SectionCollection.

Overload List

OverloadDescription
Remove(Section)Removes the specified Section from the SectionCollection if it exists.  
Remove(Int32)Removes the Section at the specifed index from the SectionCollection.  

Example

C#Copy Code
private void btnDynamic_Click(object sender, System.EventArgs e)
{
   DataDynamics.ActiveReports3.ActiveReport rpt =
new DataDynamics.ActiveReports3.ActiveReport();
   rpt.Sections.Add(DataDynamics.ActiveReports3.SectionType.Detail,
"detail");
   rpt.Sections.InsertPageHF();
   rpt.Sections.Insert(0,DataDynamics.ActiveReports3.SectionType.ReportHeader,
"rh");
   rpt.Sections.Insert(4,DataDynamics.ActiveReports3.SectionType.ReportFooter,
"rf");
   rpt.Sections[0].BackColor = System.Drawing.Color.PowderBlue;
   rpt.Sections[1].BackColor = System.Drawing.Color.DarkOrchid;
   rpt.Sections[2].BackColor = System.Drawing.Color.Orchid;
   rpt.Sections[3].BackColor = System.Drawing.Color.DarkOrchid;
   rpt.Sections[4].BackColor = System.Drawing.Color.PowderBlue;
   rpt.Sections.Remove(0);
   rpt.Sections.Remove(3);
   rpt.Run();
   
this.arv.Document = rpt.Document;
}
Visual BasicCopy Code
Private Sub btnDynamic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDynamic.Click
    Dim rpt As New DataDynamics.ActiveReports3.ActiveReport
    rpt.Sections.Add(DataDynamics.ActiveReports3.SectionType.Detail, "Detail1")
    rpt.Sections.InsertPageHF()
    rpt.Sections.Insert(0, DataDynamics.ActiveReports3.SectionType.ReportHeader, "rh")
    rpt.Sections.Insert(4, DataDynamics.ActiveReports3.SectionType.ReportFooter, "rf")
    rpt.Sections(0).BackColor = System.Drawing.Color.PowderBlue
    rpt.Sections(1).BackColor = System.Drawing.Color.DarkOrchid
    rpt.Sections(2).BackColor = System.Drawing.Color.Orchid
    rpt.Sections(3).BackColor = System.Drawing.Color.DarkOrchid
    rpt.Sections(4).BackColor = System.Drawing.Color.PowderBlue
    rpt.Sections.Remove(0)
    rpt.Sections.Remove(3)
    rpt.Run()
    Me.Viewer1.Document = rpt.Document
End Sub

Remarks

You should always remove the matching header/footer section when removing either a header or a footer section.  The Detail section cannot be removed from the collection.

Removing a section from the collection adjusts the index of the remaining sections.

See Also