ActiveReports for .NET 3 Online Help Request technical support
Using the ActiveReports Windows Form Viewer
See Also
User Guide > Getting Started > Viewing Reports > Using the ActiveReports Windows Form Viewer

Glossary Item Box

The following demonstrates how to add the ActiveReports Windows Form Viewer to projects. In this example, the report is named "rptMain." When referring to this example please remember that you will need to replace "rptMain" with the name of the report used in your project. For example, in the 2D Bar Chart walkthrough, the report is named "rptBarChart." So in order to use this code for that walkthrough, you would replace the reference to "rptMain" with "rptBarChart."   

To use the ActiveReports Windows Form Viewer to preview report output

  1. Add an ActiveReport to your Visual Studio project and rename it rptMain.
  2. Add a new "Windows Form" to your project.
  3. Click on the ActiveReports viewer control in the appropriate toolbox and drag it onto your Windows form.
  4. Set the viewer control's Dock property to Fill.

To write the code for the viewer in Visual Basic or C#

The following example shows what the code for the method looks like.

' Visual Basic
Private Sub myForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ MyBase.Load
Dim rpt As New rptMain()
Viewer1.Document = rpt.Document
rpt.Run()
End Sub
//C#
private void myForm_Load(object sender, System.EventArgs e)
{
rptMain rpt = new rptMain();
this.viewer1.Document = rpt.Document;
rpt.Run();
}
You need to include references to the RtfExport and TextExport dlls in order to enable the viewer's copy button

See Also

©2009. All Rights Reserved.