Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Sir,

I want to print a report present in CrystalReportViewer Control through a Button.
I Wrote
CrystalReportViewer1.PrintReport();



then It shows the PrintDialog Box. I don't want that dialog box. I want whatever default printer is available in the machine that should work. and directly the print out.
just want to skip the print Dialog Box.

Thanks in advance

XML
Actually I am printing the report from different form of c# and using some criteria. I don't want to use ReportDocument any other way by using CrystalReportViewer only.
Than will help me.
my code is:
  <pre>BillReportPrint br = new BillReportPrint();
            br.MdiParent = this.MdiParent;
            br.textBox1.Text = textBox2.Text;
            br.crystalReportViewer1.PrintReport();
</pre>
don't want the PrintDialog Box
Posted
Updated 2-May-11 8:42am
v3
Comments
Nagy Vilmos 2-May-11 9:45am    
Added CrystalMeths tag.

The PrintReport method also gives you the option of selecting a range of pages to print, either all, or a specified range.
To print without displaying the dialog box
1. Add a CommandButton to a Form.
2. In the button's Click event, place the following code:
3. DataReport1.PrintReport False
Or, to specify a range of pages to print, use the code below:
DataReport1.PrintReport False, rptRangeFromTo, 1, 2
Ex:-
ReportDocument rd = new ReportDocument();
rd.Load("Path of .rpt file");
crystalReportViewer1.ReportSource = rd;
crystalReportViewer1.Refresh();
rd.PrintToPrinter(1, false, 0, 0);

take a look there[^] for more details.
 
Share this answer
 
Here you go

Automatically Printing Crystal Reports in ASP.NET[^]

It contains two ways both server & client side.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900