28/04/2015 by Nitesh

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 post we will see how we can create a very simple report using Infragistics set of controls. This post assumes that you have already installed Infragistics Reporting on your system. If not, you can download it from . Let’s get started –

  • Open Visual Studio & create a new Windows project. I will name the project as IGReport1 (here IG stands for Infragistics)infragisitcs-reporting-1
  • I have added a Report folder in my project to store all reports under same location. Then we add a new Infragistics Report to the project using “Add New Item”.infragisitcs-reporting-2
  • Once the report is added, you will see all relevant libraries are automatically referenced by Infragistics in the project and the report would look something like below screenshot –infragisitcs-reporting-3
  • Now, we will 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 1st icon as marked in Red above to add a new data source.infragisitcs-reporting-4
  • Choose your type of Data Source and Click Next. We will use SQL Data Source for now.infragisitcs-reporting-5
  • 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.infragisitcs-reporting-6infragisitcs-reporting-7
  • Once the connection is configured, the wizard displays you 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 your choice. Once you have created the query, click Next.infragisitcs-reporting-8
  • 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 datainfragisitcs-reporting-9
  • After the data source has been configured, you would see the entire columns under “Report Data Explorer” as belowinfragisitcs-reporting-10
  • Time to put the fields on the report. Just drag the data source , here ‘SqlDataSource1’ to the Report Body section and you’re done.infragisitcs-reporting-11
  • You can also click on “Preview” button present at the bottom of the report designer to view the final report how it looks like. The one we created looks like below –infragisitcs-reporting-12
  • Our Report part is done. Now, let us show this report on the Windows form. To show an Infragistics report in Windows Forms project, we will need another control provided by Infragistics named as “UltraReportViewer”. Let us add the control to our main form and configure it to display the report.infragisitcs-reporting-13
  • Now, run the project and it will look something similar to the below one.infragisitcs-reporting-14

Hope you like this article. Keep learning and sharing!

#.Net#Infragistics#Reporting#Winforms