Skip to main content
A newer version of this page is available. .

How to: Bind a Report to a Dataset Populated from an XML File (Runtime Sample)

This tutorial describes the steps used to connect a Snap application to an .xml file.

Follow these steps to connect your Snap application to an .xml file.

Connect to Data

  1. Start Microsoft Visual Studio 2012, 2013, 2015, 2017 or 2019, and create a new Windows Forms application, or open an existing one.
  2. Drop the SnapControl from the DX19.1: Reporting Toolbox tab on the application’s main form.
  3. To connect the application to data, handle the Load event of the application’s main form and write the following code in the event handler.

    
    using System;
    using System.Data;
    using System.Windows.Forms;
    // ...
    
    private void Form1_Load(object sender, EventArgs e) {
        DataSet xmlDataSet = new DataSet();
        xmlDataSet.ReadXml("C:\\Users\\Public\\Documents\\DevExpress Demos 14.1\\Components\\Data\\Cars.xml");
        snapControl1.Document.DataSource = xmlDataSet;
    }
    

View the Result

The Snap application is now ready. Run it to create your report.

To design the report layout, drop fields from the Data Explorer onto the report editing surface.

Dataset-Populated-from-an-XML-File