Integrating reports is an easy way to add value to your application and can be an important component of your application's offering. Before we get started on actually integrating Crystal Reports .NET with your Windows application, we need to do a little planning to make sure the integration goes smoothly.
First, we need to have a report (or suite of reports) to work with. In Chapter 2, "Getting Started with Crystal Reports .NET," we walked through the report planning and design process, so you should have a start on the skills you need to design reports.
If you flipped straight to this chapter or haven't gotten into designing your own reports yet, there are some sample reports located in C:\program files\Visual Studio .Net 2003\Crystal Reports\ Samples\ that you can use to practice concepts from this chapter; alternatively, there are the sample reports included in the download file as well.
We need to plan for how those reports will be delivered to users and the forms that will be required to host them. Crystal Reports .NET uses a feature-rich report viewer that can be inserted onto a Windows Form and used to view reports. The viewer itself has an extensive object model, allowing you to set the source of the report, the appearance of the viewer itself, and what happens when different events fire.
Most applications can utilize a single Windows Form hosting the Crystal Report Viewer and simply pass properties like the report source and viewer settings to this form. This lends itself to a number of creative solutions for user personalization and settings. You could store viewer settings and preferences in a table or XML file for each user (or group or role) and apply these settings when viewing a report.
In addition, you could also set specific record selection formulas for different groups of users, allowing them access only to the data applicable to them. You could also create a custom user interface, allowing users to set and retain parameter settings for future use, or even to keep their printing or export preferences, such as frequently used e-mail addresses.
Ultimately, the report integration should be driven by the user's requirements, but how these features are delivered is up to you. As you go through the rest of the chapter, think about how the different customization features could be used in your development. If you are not at a point where you can integrate these features into your application, all of the properties, methods, and events are grouped together by function to make it easier to come back and look them up.
Was this article helpful?