Step 2 of 3: Adding Reports to the Control
In This Topic
In the last step you created a new application and added the C1ReportViewer to the project. In this step you'll add a data source to your application and load a report into the C1ReportViewer control without using any code at all. Note that in this step you'll use the CommonTasks.xml example file which should be installed in the ComponentOne Samples folder.
Complete the following steps:
- Navigate to the Solution Explorer window, right-click the project name, and choose New Folder.
- Name the new folder "~/tempReports".
Note: The above two steps are optional. The tempReports folder is created automatically when the report is rendered. It is used to store or cache the generated data on report rendering. Therefore, you should grant read and wrtie permissions to this folder when deploying the application.
- In the Solution Explorer, right-click the App_Data folder and select Add Existing Item. The Add Existing Item dialog box will appear.
- In the Add Existing Item dialog box locate the C1Nwind.mdb file and click the Add button to close the dialog box and add the file to the project.
- By default, the C1NWind.mdb file will be located in the Documents or My Documents folder at ComponentOneSamples\Common.
- In the Solution Explorer, right-click the project name and select Add Existing Item. The Add Existing Item dialog box will appear.
- In the Add Existing Item dialog box locate the CommonTasks.xml report definition file and click the Add button to close the dialog box and add the file to the project.
- By default, the CommonTasks.xml file will be located in the Documents or My Documents folder at ComponentOneSamples\C1Report\C1Report\XML\CommonTasks.
Note: Report definition files are created with a separate utility, the C1ReportDesigner. The C1ReportDesigner works like the Access report generator, and is the same designer that ships with the C1Report component. The designer lets you create new reports from scratch or import existing ones from Microsoft Access and Crystal Reports. For more information on the C1ReportDesigner, see Working with the C1ReportDesigner in the Reports for WinForms documentation.
- Click once on the C1ReportViewer control so that it is selected and navigate to the Properties window.
- In the Properties window, set the FileName property to "~/CommonTasks.xml".
- In the Properties window, set the ReportName property to "01: Alternating Background (Greenbar report)".
The C1ReportViewer will now display this report at run time.
In this step you added data source to your application and loaded a report into the C1ReportViewer control without using any code. In the next (and last) step you'll run your application and see the C1ReportViewer control in action.
See Also