12-25-2007, 3:54 AM
|
|
HOW TO: Create a report instance by name
|
|
|
|
|
If you want providing to user a possibility of choosing of the reports for displaying, you can use a following walkthrough:
1) Create the windows application project. 2) Add the Active Reports Viewer control on the form. 3) Add several reports in project (e.g. named Report1, Report2, Report3) 4) Add the ComboBox control on the form. 5) Add the report names to the items collection of ComboBox. 6) Add the following code in SelectedItemChanged event of ComboBox.
[VB.NET]
Dim my_type As Type Dim ar As New Report1 Dim ar2 As New DataDynamics.ActiveReports.ActiveReport my_type = Type.GetType(ar.GetType().AssemblyQualifiedName.Replace("Report1", ComboBox1.SelectedItem.ToString()), True) ar2 = Activator.CreateInstance(my_type) ar2.Run() Viewer1.Document = ar2.Document
[C#]
Type my_type; Report1 ar = new Report1(); DataDynamics.ActiveReports.ActiveReport ar2= new DataDynamics.ActiveReports.ActiveReport(); my_type = Type.GetType(ar.GetType().AssemblyQualifiedName.Replace("Report1", ComboBox1.SelectedItem.ToString()), True); ar2 = Activator.CreateInstance(my_type); ar2.Run(); Viewer1.Document = ar2.Document;
Applies To: ActiveReports for .NET 1.0 ActiveReports for .NET 2.0 ActiveReports for .NET 3.0
|
|
|
|
|