Determining the Correct Object Model
When working with Windows applications, you have two different object models to choose from, depending on your particular needs. The first, contained within the Crystal Reports Windows Forms Viewer object model (CrystalDecisions.Windows.Forms), contains all of the functionality required to view a report in the Crystal Reports Windows Forms Viewer and includes the ability to set database logon information, pass parameters and record selection, control the viewer's appearance, and view reports, including reports consumed from an XML Report Web Service.Using this object model, you can satisfy most basic report integration requirements, but you have no control over the report itself - you won't be able to change the record selection for any subreports that appear in your report, and you won't have access to modify report elements, such as groups, and sorting and formula fields.
NoteFor more information on working with groups and sorting check out Chapter 2: Getting Started with Crystal Reports.NET.
You also need to use the Crystal Reports Engine object model (CrystalDecisions.CrystalReports.Engine) for complete control over your report and the objects and features contained within. Using the Crystal Reports Engine, you are provided with a rich object model that can be used to modify even the smallest elements of your report.
NoteYou will also need to use this object model if you are using ADO (.Net or "Classic" ADO) as the data source for your report (which is covered in Chapter 6: Working with .NET Data).
It is important to note that the Crystal Reports Engine object model cannot stand alone - it provides no way to view a report and relies on the Crystal Reports Windows Forms Viewer to actually view the report. The functionality covered by the Report Engine is reviewed in Chapter 8, as well as examples of some of the most commonly used features.Crystal Decisions recommends that you do not overlap these two object models and try to use properties and methods from both at the same time. An example would be where you are setting a parameter field value in the Report Engine object model - you wouldn't want to also try to set a parameter field in the same report using the Crystal Reports Windows Forms Viewer object model. Try to pick an object model based on your requirements and stick with it throughout your application.
NoteA good rule of thumb to apply, when making a decision about which object model to use, is that the Report Viewer can be used with simple applications (preview, print, export) where you don't need to change the report's design, or elements within the report. If you need more granular control over the report content, you are going to need to use the Report Engine in conjunction with the Report Viewer.