Solved

PrinttoPrinter Method of Strongly typed report does not print data

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

17 Experts available now in Live!

Get 1:1 Help Now