To use the ActiveReports Windows Form Viewer to preview report output
- Add an ActiveReport to your Visual Studio project and rename it rptMain.
- Add a new "Windows Form" to your project.
- Click on the ActiveReports viewer control in the appropriate toolbox and drag it onto your Windows form.
- Set the viewer control's Dock property to Fill.
To write the code for the viewer in Visual Basic or C#
- Double-click the title bar of the Windows Form to create an event-handling method for the Load event of the Windows form. Add code to the handler to:
- Format the viewer to show the report when it is run
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 |