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.