Put a dropdownlist for the page and add the following to the pageload event:Code:
For each iprt as string in system. Drawing. Printing. printersettings. installedprinters
Dropdownlist1.items. Add (iprt)
Next
Put a button and click the event:
Dim reportdoc as reportdocument = new reportdocument ()
Reportdoc. Load (server. mappath ("crystalreport1.rpt "))
Reportdoc. printoptions. printername = dropdownlist1.selecteditem. Text
Reportdoc. printtoprinter (1, false, 0, 0)
Passed the test on vs2005.
Today, we found a good way to drag the screen into the crystalreportsource space crystalreportsource1, drag a sqldatasource, filter data in sqldatasource, then bind it to crystalreportsource, and execute the following sentence to print
Crystalreportsource1.databind (); 'retrieve the filtered data crystalreportsource1.reportdocument. printername = dropdownlist1.selecteditem. Text
Crystalreportsource1.reportdocument. printtoprinter (1, false, 0, 0)