ActiveReports 8 > ActiveReports User Guide > Samples and Walkthroughs > Walkthroughs > Common Walkthroughs > Web > Document Windows Application |
In ActiveReports, you can use a Web Service that returns the content of an ActiveReport to show in the Windows Forms viewer control.
This walkthrough illustrates how to create a Windows client application that returns the content of an ActiveReports in the Windows Forms viewer.
This walkthrough builds on the Document Web Service walkthrough and is split up into the following activities:
Note: Refer to Document Web Service to set up Web service that returns an ActiveReports document. |
To create a Visual Studio project
To add the Viewer control
To add a web reference
To add a reference to a web service in Visual Studio 2008 or 2010 that is compatible with .NET Framework 2.0 Web service
To add a reference to a web service in Visual Studio 2008 or Visual Studio 2010
To display the content returned by the Document Web Service in the viewer
To display the report content (for Visual Studio 2008 or 2010 compatible with .NET Framework 2.0 Web service)
The following example shows what the code for the method looks like.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Form Load event. |
Copy Code
|
---|---|
Dim ws As New localhost.Service Me.Viewer1.Document.Content = ws.GetProductsReport() |
To write the code in C#
C# code. Paste INSIDE the Form Load event. |
Copy Code
|
---|---|
localhost.Service ws = new localhost.Service(); this.viewer1.Document.Content = ws.GetProductsReport(); |
To display the report content (for Visual Studio 2008 or 2010)
The following example shows what the code for the method looks like.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Form Load event. |
Copy Code
|
---|---|
Dim ws As New ServiceReference1.ServiceSoapClient() |
To write the code in C#
C# code. Paste INSIDE the Form Load event. |
Copy Code
|
---|---|
ServiceReference1.ServiceSoapClient ws = new ServiceReference1.ServiceSoapClient(); |
To update the app.config file
Note: You need to update the app.config file if you added the Service Reference to the Visual Studio 2008 or 2010 project in the previous section. |
To run the project
Press F5 to run the project.