Glossary Item Box

Concepts: Scripting

See Also ActiveReports for .NET 2 Online Help Send feedback to Data Dynamics

Access Controls In Script

Use ((ControlType)rpt.Sections[SectionName].Controls[ControlName]) to type cast a control and access its properties.

If the project loads an RPX file into a new ActiveReport object, the script must refer to each control by using ((ControlType)rpt.Sections[SectionName].Controls[ControlName]). The reason for doing this is that a new ActiveReport object is not aware of the objects contained inside the RPX file. If you are using script in a report contained in a project and just creating a new instance of the report class you can use "rpt".

[C#] private void Form1_Load(object sender, System.EventArgs e) { ActiveReport rpt = new ActiveReport(); rpt.LoadLayout("ActiveReport1.RPX"); rpt.Run(); this.viewer1.Document = rpt.Document; }

[Visual Basic] Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _ MyBase.Load Dim rpt as new ActiveReport() Rpt.LoadLayout("ActiveReport1.RPX") rpt.Run() Me.Viewer1.Document = rpt.Document End Sub

[Script] public void Detail_Format() { ((TextBox)rpt.Sections["Detail"].Controls["TextBox1"]).Text = "Hello"; }

Concepts: Scripting

 

 


Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.