Solved

PrinttoPrinter Method of Strongly typed report does not print data

Posted on 2004-09-17
6
240 Views
Last Modified: 2008-02-20
crLoadConfirmation = New LoadConfirmation

                    count = crLoadConfirmation.Database.Tables.Count()
                    Debug.WriteLine("LoadConfirmationCount= " & count)
                    '==============================================
                    'crLoadConfirmation = changeLCReportLocation(crLoadConfirmation)
                    '======================================

                    crParameterDiscreteValue = New ParameterDiscreteValue
                    crParameterDiscreteValue.Value = load

                    crParameterField = New ParameterField
                    crParameterField.ParameterFieldName = "LoadNo"
                    crParameterField.CurrentValues.Add(crParameterDiscreteValue)

                    crParameterFields = New ParameterFields
                    crParameterFields.Add(crParameterField)
                    Me.CrystalReportViewer1.ParameterFieldInfo = crParameterFields
                    Me.CrystalReportViewer1.ReportSource = crLoadConfirmation
                   
                    crLoadConfirmation.PrintToPrinter(1, False, 1, 1)

That is a sample of my code. If i use the same code and open the report in the Report Viewer my data is present. Printing it this way The structure of the report is there, but no data is present.


here is a code sample of wher I use the Report Viewer for the same report:
 ''CR Variables
                    crLoadConfirmation = New LoadConfirmation

                    count = crLoadConfirmation.Database.Tables.Count()
                    Debug.WriteLine("LoadConfirmationCount= " & count)
                    '==============================================
                    'crLoadConfirmation = changeLCReportLocation(crLoadConfirmation)
                    '======================================

                    crParameterDiscreteValue = New ParameterDiscreteValue
                    crParameterDiscreteValue.Value = load

                    crParameterField = New ParameterField
                    crParameterField.ParameterFieldName = "LoadNo"
                    crParameterField.CurrentValues.Add(crParameterDiscreteValue)

                    crParameterFields = New ParameterFields
                    crParameterFields.Add(crParameterField)
                    Me.CrystalReportViewer1.ParameterFieldInfo = crParameterFields
                    Me.CrystalReportViewer1.ReportSource = crLoadConfirmation
0
Comment
Question by:ecathell
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 12084154
The report views ok?  Can you print it from the viewer?

Try
crLoadConfirmation.PrintOut False

mlmcc
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12084225
 crLoadConfirmation.PrintToPrinter(1, False, 1, 1)

why are yuo printing the only 1st page

if you want to print every page you should use
  crLoadConfirmation.PrintToPrinter(1, False, 0, 0)
and for the sake of it i will run this code before you set the viewer's datasource

Regards
Emre

0
 

Author Comment

by:ecathell
ID: 12084975
crLoadConfirmation.SetParameterValue("LoadNo", crParameterDiscreteValue.Value)
                    crLoadConfirmation.PrintToPrinter(1, False, 1, 1)

actually I am printing only one page because there is just one page.

This is the answer to my problem, i discovered it on my own. Because the report is no longer actually using the viewer I have to pass the parameter value to the report and not the viewer control.

Eric
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12302428
Sounds good
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12327403
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now