NetAdvantage Reporting in Windows Forms

Tom Puglisi / Tuesday, November 29, 2011

So you want to add reporting capabilities to your Windows Forms applications, how is this done? By using the new Infragistics NetAdvantage Reporting product, you can now create and add reports to your Windows Forms applications easily!

In this topic, I will show Windows Forms developers how to create a new report in Microsoft™ Visual Studio™ using the Infragistics NetAdvantage Reporting product and then display your report in a Windows Form.


Getting Started

Create a NEW Windows Forms project named “NetAdvantage_Reporting_in_WinForms”. Add a new folder to your project named “Reports”.

Double-click on Form1 and get it into design mode. You will add two Infragistics Windows Forms controls to it. In your Visual Studio toolbox, locate the Infragistics NetAdvantage 11.2 toolbox tab and in this tab, drag and drop the UltraComboEditor control onto your form. Set its Dock property to “Top”. Then locate the NetAdvantage Reporting Windows Forms toolbox tab and then drag and drop the UltraReportViewer control onto your form and set its Dock property to “Fill”. Everything should look like this so far:

Creating a Simple Report

To create a new report, locate and right-click the Reporting folder you created earlier and select “Add New Item”.


In the Add New Item dialog, Locate the Infragistics node, expand it and select Reporting. You will then select the “Infragistics Report” item from the list of various Infragistics Reporting items.

Name the report “Product_Listing".igr” and click ADD.

Design the Report

To design the content of the report, double click the Infragistics Report you just added to your project. You can now design the report using the intuitive Infragistics design-time user interface. We will keep things simple in this topic, so to start designing the report, click the Add “A Report Data Source…” icon located in the center of your report that is shown in design mode. You can navigate to an instance of the Microsoft™ Northwind™ database sample that you should have running somewhere that is accessible. Select the Products table for this particular report. Locate the Report Data Explorer tab in Visual Studio and bring it into view. You are now ready to select data to show on your report.

In the Report Data Explorer, locate and control+click the following three fields:

  • ProductName
  • UnitPrice
  • UnitsInStock

With these three fields selected, drag and drop them as one unit onto the center of the Report Body. This is how you define which data fields will be presented in the Report Body. You can feel free to experiment setting properties on the various items that were just generated. For example, select the entire Header row in the Table that was just created and then set its background color to a color of your choice.

Let’s create a Title for this report by finding the Visual Studio Toolbox, locating the NetAdvantage Reporting toolbox tab and then drag and drop a Label control onto the Page Header portion of the report. This is located towards the top of the report in design mode. Change the Text to “Northwind Product Listing” and then change the Label’s Font size to 30. Feel free to experiment with other properties such as color and alignment.

Make sure your report works by clicking the Preview button located on your report in Design Mode:

Show the Report

Now it is time to show your report to your end users. Before moving onto the next step, you can feel free to create more reports using the same technique that you just learned in the previous steps. Create a few more reports that pull data from other data sources you may have available and add them to the Reports folder in this project.

Note: I have two reports in this project, one named Northwind_Customer_Listing.igr and the other named Product_Listing.igr.


Write the following code in the Form_Load event:

 private void Form1_Load(object sender, EventArgs e)


Next, handle the UltraComboEditor control’s ValueChanged event and add the following code to that event:

private void cboReportList_ValueChanged(object sender, EventArgs e)
            string reportMain = 
           this.ultraReportViewer1.RenderSettings.DefinitionUri = 
                new System.Uri(
                    this.cboReportList.Value.ToString() ), 

Run the App

That’s it! Now run the application and select a report from the UltraComboEditor control. The report that you selected should automatically load in the UltraReportViewer control. You can also zoom in and out, export, and navigate the entirety of this report.

This is all that is needed to add reporting to your Windows Forms applications using the Infragistics NetAdvantage Reporting product!

Taking it to the next level

I showed you how to create and display simple reports in a simple application. As you learn how to take advantage of more advanced reporting capabilities, you can create more compelling reports with charts, filter parameters, and many more features such as grouping, summaries, and aggregate functions. You can also come up with a more elegant report title navigation user interface that allows your end users to navigate, select, and display reports. Think of other Infragisics NetAdvantage Windows Forms controls that you could use such as the UltraExplorerBar, UltraDockManager, and UltraTree. The rest is up to you to make it happen!