PrintReport dialogbox with Crystal report in visual basic 2008

I'm using Visual basic 2008 and  I would like to know if there Is there a way to not have the Print Dialog pop up when I use printreport to send to printer
Private Sub frmRapport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
        Me.CrystalReport31.SetParameterValue(0, My.Settings.NoContrat.ToString)
        If not PrintDocument1.PrinterSettings.IsValid = False Then
            Me.CrystalReportViewer1.PrintReport()
            Me.Close()
        End If
    End Sub

Open in new window

sylvainhotteAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
All Crystal Reports class instances inherit from ReportClass/ReportDocument, and so if you have a report instance, then it should have the PrintToPrinter method.
0
 
mlmccCommented:
I believe there is a flag.

Try

Me.CrystalReportViewer1.PrintReport(true)

It may be that false is the value

mlmcc
0
 
sylvainhotteAuthor Commented:
Well I tried but it does not take a boolean value or a number value.

Thank but it's not the answer!
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
mlmccCommented:
I don't know.  The method I used had a flag to show or not show the printer options

mlmcc
0
 
sylvainhotteAuthor Commented:
Thanks anyway.

I tried different way dut as soon as I add False. False become underlined in bleu.

So it does not seem to accept the false

Thanks

Sylvain
0
 
Bob LearnedCommented:
I believe that you cannot override the PrintReport method to not display the dialog.  I would use the ReportDocument.PrintToPrinter method instead of the CrystalReportViewer.PrintReport method.
0
 
sylvainhotteAuthor Commented:
Hi, thank this seems like a good idea. Except that I may be missing some reference can you help me

When i write
ReportDoucument.

The choice that show are EnabledEventLog
Equals
ReferenceEquals

But not PrintToPrinter

Am I doing something wrong?


Thanks a lot
sylvain
0
 
sylvainhotteAuthor Commented:
Well Ok I got It.

Thanks
Wow I was slow on this.
sylvain
0
 
CodeCruiserConnect With a Mentor Commented:
Use this function
PrintToPrinter

More Info
http://www.vbforums.com/archive/index.php/t-242041.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.