Adding Crystal Reports to Projects
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Adding Crystal Reports to Projects

Visual Studio .NET 2003

A report added to a Visual Basic or C# project is a "strongly-typed" report. A report source file, containing a report class specific to this report, is automatically created for it. This report class has ReportClass as its base class. For more information on the ReportClass class, please refer to the derived class ReportDocument.

The report source file also shows sections of the Crystal report. These sections should not be modified.

The report source file has the extension .cs for a Visual C# project, and .vb for a Visual Basic project. This file is normally hidden. You can click the Show All Files icon to list it (e.g., under CrystalReport1.rpt) in the Solution Explorer.

Note   Unlike reports added to Visual Basic or C# projects, no report class or report source file is automatically created for reports added to C++ projects. You can add code to create the corresponding report classes for these reports.

To add a new Crystal report to a project

  1. In the Solution Explorer, right-click the project name, point to Add and select Add New Item from the shortcut menu. (Alternatively, highlight the project name in the Solution Explorer; from the Project menu in the Visual Studio Standard Toolbar, select Add New Item.)
  2. In the Add New Item dialog box, select Crystal Report from the Templates pane.

    Alternatively, expand the folder tree in the Categories pane, highlight Utility, and select Crystal Report from the Templates pane.

  3. Enter a report name with an .rpt extension in the Name field. Or, accept the default report file name, CrystalReport1.rpt, if it exists.
  4. Click Open to invoke the Crystal Report Designer that helps you create and design the new report.

To add an existing Crystal report to a project

  1. In the Solution Explorer, right-click the project name and point to Add and select Add Existing Item from the shortcut menu.
  2. In the Add Existing Item dialog box, select All Files under Files of type. Specify the location and name of the report you are adding.

See Also

CrystalReportViewer Properties | Untyped Report Components

Show:
© 2016 Microsoft