By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,773 Members | 1,777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,773 IT Pros & Developers. It's quick & easy.

Crystal Reports PrintToPrinter Method

P: n/a
Hello group!

I'm facing a strange problem in the application I'm writing...

I'm using crystal reports for printing sale receipts, and I wrote this lines of code:

rpt.Parameter_SaleID.CurrentValues.AddValue((int)t his.CurrentSale.Row["SaleID"]);
rpt.Parameter_TaxValue.CurrentValues.AddValue(tax) ;
rpt.PrintOptions.PrinterName = "SAMSUNG SRP270";
rpt.PrintToPrinter(1, false, 0, 0);

In my report I'm using parameter fields to set the record selection formula and to apply taxes.
Every line works fine, except for the last one, which rises the exception IndexOutOfRangeException that idicates that the index doesn't fit in the matrix (I don't know why).

If I use the report viewer to show a preview of the sale receipt, I can print it from the tool bar, but I don't want to use the viewer.

I'd really appreciate your help...

Thank you all...
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Can you post the exact text of the error message that you're getting?
As in, make it happen, then copy and paste it here?

Nov 16 '05 #2

P: n/a
Hello group!!!

I'm going to reply to myself... :)

I can call the PrintToPrinter method if I set the PrintOptions.PageMargins
data before:

CrystalDecisions.Shared.PageMargins pageMargins = new
CrystalDecisions.Shared.PageMargins(1, 1, 1, 1);

rpt.PrintOptions.PrinterName = "SAMSUNG SRP270";
rpt.PrintToPrinter(1, false, 0, 0);

Now my application is working fine...

Anyway... thank you all...
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.