I am using a ReportViewer and I would like to print my report.
When I click on the print button, a dialog box opens. It is similar to this.
I would like my program to skip this dialog and choose the default printer.
Is there a way to do one of the following things:
- Just skip the dialog box
- Map the print button to a function I wrote and that prints the report without showing the dialog box: something similar to
myButton.Click += new EventHandler(myButton_Click);
I checked MSDN but found nothing to alter the default toolbar.
Edit: I did find this discussion from 2006, where an answer basically says that it is not possible. I guess that hiding the toolbar and creating my own would be a solution but it's a bit overkill.
UPDATE: This is not a duplicate. I know there is a question called "How to print a ReportViewer's report without showing a form", in which the guy wants to be able to choose between showing the form and printing the report. This is not my problem. I do want to display the form, and I want that when I click on the Print button, it prints the report, without asking me which printer to use.