Change behaviour of Print button in ReportViewer C# -


i using reportviewer , print report.

when click on print button, dialog box opens. similar this.

excel print dialog box

i program skip dialog , choose default printer.

is there way 1 of following things:

  • just skip dialog box
  • map print button function wrote , prints report without showing dialog box: similar mybutton.click += new eventhandler(mybutton_click);

i checked msdn found nothing alter default toolbar.


edit: did find this discussion 2006, answer says not possible. guess hiding toolbar , creating own solution it's bit overkill.

update: not duplicate. know there question called "how print reportviewer's report without showing form", in guy wants able choose between showing form , printing report. not problem. do want display form, , want when click on print button, prints report, without asking me printer use.

i found solution !

more precisely found workaround enables call custom printing function.

you need use print event of reportviewer.

you can catch event, cancel , call own printing function:

myviewer.print += new canceleventhandler(myviewer_print); void myviewer_print(object sender, canceleventargs e) {     e.cancel = true;     mycustomprintfunction(); } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -