Skip to end of metadata
Go to start of metadata

Purpose

This wiki page was created to display a collection of code samples for the Crystal Reports .NET SDK.

Overview

The samples included on this page vary from general introductory samples to viewing reports, modifying database info, passing/modifying parameters, exporting and printing reports, and report modification with the InProcess RAS SDK.

#General
#Viewing
#Database
#Parameter
#Exporting/Printing
#Report Modification #SAP Crystal Reports, developer version for Microsoft Visual Studio

 

General

Crystal Reports .NET - All Sample Applications
This set includes the following samples:

  • cr_net_sdk_tutorial_samples_en.zip
  • crsdk_net_samples_12.zip
  • NET-CPP2005_CRNET_CR115_Change_Record-Selection-Formula.zip
  • NET-CS-Win_CR12_Creating-Custom-Addins.zip
  • NET-CS_CRNET_CR115_Get_SQL-Query.zip
  • NET-CS2003_RAS-Unmanaged_CR115_Modify_Command-Table-SQL.zip
  • NET-CS2005_CRNET_CR115_Modify_Image-Location.zip
  • NET2003-CS-Web_CRNET_CR115_change_graphic-location.zip
  • NET-Cplus-Win_CRNET_CR115_Get_Viewer-Events.zip
  • NET-CPP-Win2005_CRNET_CR115_view_report.zip
  • NET-CS2005_CRNET_CR115_Set_Viewer-Locale-by-Page.zip

Crystal Reports 2008 .NET SDK Tutorial Samples
This sample contains Visual Studio 2005 Web sample code projects that highlight features of the Crystal Reports .NET SDK, including viewing and exporting reports, filtering data and setting parameters, and connecting to different data sources.

Crystal Reports .NET SDK - Sample Applications from Tutorials
This file contains C# and VB .NET Windows and web sample applications. These samples were built using the tutorials provided in the 'Crystal Reports .NET SDK - Additional Documentation and Tutorials' (cr_net_sdk_additional_en.zip). These sample applications apply to Crystal Reports 9 and 10, and Crystal Reports for Visual Studio .NET 2002 and 2003.

Csharp (C#) Web Sample Applications for use in Microsoft Visual .Net 2002 and Later
This set includes the following samples:

  • csharp_web_accesssubreport.zip
  • csharp_web_adonet.zip
  • csharp_web_discreteparams.zip
  • csharp_web_export.zip
  • csharp_web_rangeparams.zip
  • csharp_web_serverfilereports.zip
  • csharp_web_simplelogonengine.zip
  • csharp_web_simplelogonviewer.zip
  • csharp_web_simplepreviewreport.zip
  • csharp_web_sub_daterange_param.zip
  • csharp_web_subreport_logon.zip
  • cr10_csharp_web_clientprinting.zip

VB.NET (VB) Web Sample Applications for use in Microsoft Visual .Net 2002 and Later.
This set includes the following samples:

  • vbnet_web_adonet.zip
  • vbnet_web_simplelogonengine.zip
  • vbnet_web_simplelogonviewer.zip
  • vbnet_web_export.zip
  • vbnet_web_discreteparams.zip
  • vbnet_web_multirangeparams.zip
  • vbnet_web_rangeparams.zip
  • vbnet_web_simplepreviewreport.zip
  • vbnet_web_sortfields.zip
  • vbnet_web_accesssubreport.zip
  • vbnet_web_subreport_logon.zip
  • vbnet_web_sub_daterange_param.zip
  • vbnet_web_reportpartsviewer.zip

Csharp (C#) Windows Sample Applications for use in Microsoft Visual .Net 2002 and Later
This set includes the following samples:

  • csharp_win_adodotnet.zip
  • csharp_win_classicado.zip
  • csharp_win_dbengine.zip
  • csharp_win_dbviewer.zip
  • csharp_win_DynamicImage.zip
  • csharp_win_dynamic_report_formula.zip
  • csharp_win_export.zip
  • csharp_win_exporttopdf.zip
  • csharp_win_multirangeparam.zip
  • csharp_win_oraclelogoninfo.zip
  • csharp_win_paramengine.zip
  • csharp_win_paramviewer.zip
  • csharp_win_pass_dataset_main_sub.zip
  • csharp_win_printtoprinter.zip
  • csharp_win_rangeparameters.zip
  • csharp_win_serverfilereports.zip
  • csharp_win_sortfields.zip
  • csharp_win_sub_daterange_param_engine.zip
  • csharp_win_subreport_basic.zip
  • csharp_win_subreport_logon.zip
  • csharp_win_viewer_events.zip

VB.NET (VB) Windows Sample Applications for use in Microsoft Visual .Net 2002 and Later.
This set includes the following samples:

  • vbnet_win_adodotnet.zip
  • vbnet_win_changefont.zip
  • vbnet_win_classicado.zip
  • vbnet_win_custompapersource.zip
  • vbnet_win_customviewer.zip
  • vbnet_win_dbengine.zip
  • vbnet_win_dbviewer.zip
  • vbnet_win_dynamicimage.zip
  • vbnet_win_dynamic_report_formula.zip
  • vbnet_win_export.zip
  • vbnet_win_exporttopdf.zip
  • vbnet_win_multirangeparam.zip
  • vbnet_win_oraclelogoninfo.zip
  • vbnet_win_paramengine.zip
  • vbnet_win_paramviewer.zip
  • vbnet_win_pass_dataset_main_sub.zip
  • vbnet_win_printtoprinter.zip
  • vbnet_win_rangeparameters.zip
  • vbnet_win_serverfilereports.zip
  • vbnet_win_simplepreviewreport.zip
  • vbnet_win_sortfields.zip
  • vbnet_win_sub_daterange_param_engine.zip
  • vbnet_win_sub_daterange_param_viewer.zip
  • vbnet_win_subreport_basic.zip
  • vbnet_win_subreport_logon.zip
  • vbnet_win_viewer_events.zip

Report Application Server .NET Sample Code
Contains Visual Studio 2005 Web sample code pages that highlight features of the RAS SDK, including report parameter and formula modification, database logon, and exporting.


Viewing

NET-CS2005_CRNET_CR115_Set_Viewer-Locale-by-Page
This sample shows you how to change the multilingual settings for the .NET web form viewer control (CrystalReportViewer) to any locale of your choice. The locale is set via a QueryString variable. The settings are changed on the webform page level instead of using the web.config. Changing the Regional Settings or IE Language Settings will not impact this sample. Note: This has only been tested on Crystal Reports XI R2 with Visual Studio .NET 2005

Crystal Reports .NET C++ - Get Viewer Events
This C++ .NET sample Windows application demonstrates how to access the Viewer Events for the business objects windows forms viewer.

Crystal Reports .NET C++ - View Report
This sample application shows you how to preview a Crystal Report in a .NET C++ application.

Net Delphi CR2008 Simple Previewer.
This sample demonstrates how to view and export a report using the Crystal Reports .NET SDK.


 

Database

Crystal Reports for Delphi 2005 .NET - Connect to Secure Database
This Delphi 2005 sample Windows application demonstrates how to connect to a secured database using the Crystal Reports for Visual Studio .NET Engine object model.

NET-VB2005_CR2008_SET_DB_USING_VIEWER
This sample demonstrates how to view a report by passing the database logon information to the report via the viewer. You can not use this method to change databases at runtime. It must be the database the report is designed against.

NET-CS2005_CRNET_Modify_Logon-Viewer
This sample demonstrates how to modify the userID and password used to log onto the report database using the Crystal Reports .NET Viewer SDK. There is no ReportDocument used in this sample because it is demonstrating how to pass logon info via the Viewer SDK.

NET-CS2005_CRNET_Modify_Database-ConnectionInfo
This sample demonstrates how to modify database server and logon information using the Crystal Reports .NET SDK. The code modifies the ConnectionInfo object and uses the ApplyLogonInfo method to apply the changes to the main and subreports.

NET-CS2005_CR12_SetDatabaseLogon
This sample demonstrates how to view a report by passing the database logon information to the report.  You can not use this method to change databases at runtime.  It must be the database the report is designed against.  This passes the user name and password to connections with a specified server and database name.

NET-CS2005_CR12_SetDatabaseLogon_2
This sample demonstrates how to view a report by passing the database logon information to the report.  You can not use this method to change databases at runtime.  It must be the database the report is designed against.  This passes the user name and password to all database connections in the report.

Net-Delphi-CR2008-LogonInfo-subreport.
This samples shows how to use the Crystal reports.NET SDK in Delphi Prism to set table connection info and how to access subreports.


Parameter

Crystal Reports for Delphi 2005 .NET - Pass Mulitple Parameter Values to the Viewer
This Delphi 2005 .NET sample Windows application demonstrates how to pass multiple values to a single discrete parameter field using the viewer's object model.


 

Exporting/Printing

Net Delphi CR2008 Simple Previewer.
This sample demonstrates how to view and export a report using the Crystal Reports .NET SDK.


Report Modification

 

NET2003-CS-Web_CRNET_CR115_change_graphic-location
This sample application shows how to change an image in a Crystal Report at runtime using the graphic location formula in the CR .NET SDK (C#).

NET-CS2005_CRNET_CR115_Modify_Image-Location

This sample application shows how to change an image in a Crystal Report at runtime using the graphic location formula in the CR .NET SDK (C#).

NET-CS2003_RAS-Unmanaged_CR115_Modify_Command-Table-SQL
This sample application shows how to retrieve and change the text of a SQL command table from a Crystal Report using the CR .NET SDK and in-process Report Application Server (RAS) Report Creation API (RCAPI). Note that you must have SP2 for Crystal Reports XI R2 for this sample to work. Previously you could access the RAS .NET SDK from the ReportDocument object only if you had a dedicated RAS server. Now you can use RAS in-process to accomplish this.

NET-CPP-Win2005_CRNET_CR115_Change_Record-Selection-Formula
A .NET C++ Windows application that demonstrates how to change a record selection formula at runtime.

Crystal Reports . NET C# - Get SQL Query
This sample application shows how to retrieve the SQL query from a Crystal Report using the CR.NET SDK and RAS in-process. Previously you could only access the RAS .NET SDK from the ReportDocument if you had a dedicated RAS server. Now you can use RAS in-process to accomplish this.

Crystal Reports 2008 .NET C# - Creating Custom Addins
These samples show how to create a Custom Add-In for Crystal Reports 2008. Custom Add-Ins can be used to create custom tools for the Crystal Reports designer. Samples for Visual Studio 2003 and 2005 are both included.

SAP Crystal Reports, developer version for Microsoft Visual Studio

SAP Crystal Reports, developer version for Microsoft Visual Studio Tutorial Sample Code

New Crystal Reports for Visual Studio 2010 WPF Viewer

Sorting and Filtering with Crystal Reports for Visual Studio 2010

Dynamic Grouping with Crystal Reports for Visual Studio 2010