Solved

PrinttoPrinter Method of Strongly typed report does not print data

Posted on 2004-09-17
6
242 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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 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