# Load Reports

This topic explains how to load and display a Page, RDLX, and Section report using the Viewer control in the WinForms application.

## Content

To load and display a Page, RDLX, and Section report output using the Viewer control in the Windows Forms application.

1. Create a new Windows Forms application in Visual Studio.
2. From the Visual Studio toolbox, drag the **Viewer** control onto your Windows Form Designer.
3. Set the viewer's **Dock** property to **Fill** to show the complete Viewer control on the Form.
4. Double-click the title bar of the Form to create an event-handling method for the Form\_Load event.
5. In the Form\_Load event, add the code as follows to run the report and display it in the viewer.

### Load Page/RDLX report

```csharp
string file_name = @"..\..\ReportName.rdlx";
GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(file_name));
GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport);
viewer1.LoadDocument(pageDocument);
```

```vbnet
Dim file_name As String = "..\..\ReportName.rdlx"
Dim pageReport As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo(file_name))
Dim pageDocument As New GrapeCity.ActiveReports.Document.PageDocument(pageReport)
Viewer1.LoadDocument(pageDocument)
```

### Load Snapshot

To load your RDLX-based report directly from a snapshot (.rdlx-snap file), use the following code.

```csharp
using System.IO;

viewer1.LoadDocument(
    Path.Combine(Application.StartupPath, @"C:\Temp\Report1.rdlx-snap")
); 
```

```vbnet
Imports System.IO

'Load the snapshot file into the viewer
viewer1.LoadDocument(
    Path.Combine(Application.StartupPath, "C:\Temp\Report1.rdlx-snap")
)
```

To load a snapshot from a page document, use the code as follows.

```csharp
using System.IO;

var doc = PageDocument.LoadSnapshot(new FileInfo("C:\\Temp\\Report1.rdlx-snap"));
viewer1.LoadDocument(doc);
```

```vbnet
Imports System.IO

' Create a FileInfo object for the snapshot file
Dim snapshotFile As New FileInfo("C:\Temp\Report1.rdlx-snap")
' Load the snapshot into a PageDocument
Dim doc = PageDocument.LoadSnapshot(snapshotFile)
' Show the document in the viewer control
viewer1.LoadDocument(doc)
```

### Load Code-based Section Report

```csharp
SectionReport1 sectionReport = new SectionReport1();
viewer1.LoadDocument(sectionReport);
```

```vbnet
Dim sectionReport As New SectionReport1()
Viewer1.LoadDocument(sectionReport)
```

### Load Xml-based Section Report

```csharp
GrapeCity.ActiveReports.SectionReport sectionReport = new GrapeCity.ActiveReports.SectionReport();
System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(@"..\..\SectionReport1.rpx");
sectionReport.LoadLayout(xtr);
xtr.Close();
viewer1.LoadDocument(sectionReport);
```

```vbnet
Dim sectionReport As New GrapeCity.ActiveReports.SectionReport()
Dim xtr As New System.Xml.XmlTextReader("..\..\SectionReport1.rpx")
sectionReport.LoadLayout(xtr)
xtr.Close()
Viewer1.LoadDocument(sectionReport)
```

***

**Caution**: Refresh button gets disabled when you load a section report in the Viewer control through any of the following:

* [Document Property](/activereportsnet/api/v20.1/MESCIUS.ActiveReports.Viewer.Win/GrapeCity.ActiveReports.Viewer.Win.Viewer.html)
* [LoadDocument(SectionDocument) Method](/activereportsnet/api/v20.1/MESCIUS.ActiveReports.Viewer.Win/GrapeCity.ActiveReports.Viewer.Win.Viewer.html)
* [LoadDocument(String) Method](/activereportsnet/api/v20.1/MESCIUS.ActiveReports.Viewer.Win/GrapeCity.ActiveReports.Viewer.Win.Viewer.html)

### See Also

[Samples](/activereportsnet/docs/v20.1/samples/samples-ar)
[Win Viewer](/activereportsnet/docs/v20.1/samples/samples-ar/desktop-sample/win-viewer-sample)
[Working with Snapshots](/activereportsnet/docs/v20.1/developers/working-with-reports-devs/page-rdl-report-developers/working-with-snapshots)