Results 1 to 2 of 2

Thread: print without preview the crystal report

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2017
    Posts
    1

    print without preview the crystal report

    Hi,

    I am trying to send my crystal report directly to a printer without preview. Some how my code is not working. Any help? Thanks.

    Here is the code:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim ds As New System.Data.DataSet
    Dim objDataLink As New HSC_College.DataLink
    Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
    rpt.Load(Server.MapPath("reports\" & Request.QueryString("ReportID") & ".rpt"))

    If Request.QueryString("ReportID") = "Clinical_Competency" Then
    If Not Request.QueryString("EvaluationID") Is Nothing Then
    If Request.QueryString("EvaluationID").ToString.Length > 0 Then
    Session("EvaluationID") = Request.QueryString("EvaluationID")
    End If
    End If
    Dim intEvaluationID As Integer = Session("EvaluationID")
    ds = objDataLink.spMED_GEN_ReportClinComp(intEvaluationID)
    rpt.Database.Tables(0).SetDataSource(ds.Tables(0))
    rpt.PrintToPrinter(1, False, 0, 0)
    End If
    End Sub

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: print without preview the crystal report

    Possibly useful link:

    https://www.codeproject.com/Question...tplusviewplusr

    Code:
    RptObject.PrintToPrinter(1, false, 0, 0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width