Skip to main content

Posts

Showing posts with the label crystal reports codes

How to call a report designer at runtime

How to call a report designer at runtime Crystal Report is built in object of VS. You can find it from toolbar. Drag Crystal report viewer and drop it on your form. Crystal Report viewer is container of Crystal Report, in which you can open your report(*.rpt). Following is sample code for Crystal Report... /* Init. Crystal Report object*/ CrystalReport1 rptReport = new CrystalReport1(); /* Declaration and assignment of datatable as report source for report object*/ DataTable dtTemp = new DataTable(); rptReport.SetDataSource(dtTemp); /*Init. of report file to Reportviewer to view report*/ crystalReportViewer1.ReportSource = rptReport; This will work with Crystal Report. Data report is also there but Crystal report is more professional in compare to Data report

Common crystal report code for asp.net program

Imports System.Data.SqlClient Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports System.data Public Class CrysReport ‘Variables Declaration Private obj As New Class1 Dim crParameterDiscreteValue As ParameterDiscreteValue Dim crconnectionInfo As New ConnectionInfo Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldLocation As ParameterFieldDefinition Dim thisFormulaField As CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition Dim crParameterValues As ParameterValues Dim crtableLogoninfos As New TableLogOnInfos() Dim crtableLogoninfo As New TableLogOnInfo() Dim CrTables As Tables Dim CrTable As Table ‘This function is to shows value through formula text Public Sub report_date_formula(ByVal crReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument, ByVal from_date As String, ByVal to_date As String) Try For Each thisFormulaField In crRep