Skip to Content

Invalid Index error when trying to set PrinterOptions.PrinterDuplex to Vertical

Nov 15, 2016 at 08:07 PM


avatar image
Former Member

I am using VB.Net 4.0 and Crystal 13.0.2.

In code I am trying to set the reports PrinterOptions.PrinterDuplex to Duplex.Vertical but if I set it to anything but Duplex.Simplex I get an error - Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

The line of code where it errors is -

MainReport.PrintOptions.PrinterDuplex = CrystalDecisions.Shared.PrinterDuplex.Vertical

MainReport is defined as -

Private Property MainReport As CrystalReports.Engine.ReportDocument

If the user sets it through the print dialog box then it works fine but by code it doesn't.

Any help would be greatly appreciated.

Thank you.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Brian Dong Nov 16, 2016 at 06:14 PM

Hi Chris,

Are you pointing the report to a printer first? If you set any printer settings, you have to specify which printer name and port to send the PrintOptions to. Similar to doing it through the Print Dialog, a user selects the printer and then go into the options, your code has to do the same.

Hope this helps,


10 |10000 characters needed characters left characters exceeded