How to Create a Simple Report in Windows Forms Using Infragistics Reporting

Friends,

Infragistics provides a complete cool set of products in its reporting library. In this article we will see how to create a very simple report using the Infragistics set of controls. This article assumes that you have already installed Infragistics Reporting into your system. If not, you can download it from here. Let's get started.

  • Open Visual Studio and create a new Windows project. I will name the project IGReport1 (here IG stands for Infragistics).



  • I have added a Report folder to my project to store all the reports under the same location. Then we add a new Infragistics Report to the project using “Add New Item”.



  • Once the report is added, you will see all the relevant libraries have ben automatically referenced by Infragistics in the project and the report would look something as in the following screenshot:



  • We will now configure a data source for the report to display the data. To do so, we will either click on the center of the report that says “Add a Report Data Source or use Reporting Controls from the Toolbox to start designing a report” or we can do so via “View menu > Report Data Explorer”. They both open the same window. We will be using the “Report Data Explorer” approach.

  • Click on the first icon marked in Red to add a new data source.



  • Choose your type of Data Source and Click Next. We will use a SQL Data Source for now.



  • Define the connection to SQL using the “New Connection” button and click “Next”. You can also name the Connection String to whatever you want to.





  • Once the connection is configured, the wizard displays a list of all tables/views that you can use to build a query for retrieving data for the report. You can either select a table or use “SQL Builder” to create a new query. Also, you can name your data source to whatever you choose. Once you have created the query, click Next.



  • In the next screen, you can test your query results using the “Test Query” button. If you're happy with the result set, click “Finish” else go back and modify the data.



  • After the data source has been configured, you would see the entire columns under “Report Data Explorer” as in the following



  • Now to put the fields on the report. Just drag the data source , here "SqlDataSource1" to the Report Body section and you're done.



  • You can also click on the “Preview” button present at the bottom of the report designer to view the final report to see how it looks like. The one we created looks as in the following:



  • Our Report part is done. Now, let us show this report on the Windows Forms form. To show an Infragistics report in the Windows Forms project, we will need another control provided by Infragistics named “UltraReportViewer”. Let us add the control to our main form and configure it to display the report.



  • Now, run the project and it will look something similar to the following.


I hope you like this article. Keep learning and sharing!


Similar Articles
Rebin Infotech
Think. Innovate. Grow.