473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Crystal Reports PrintToPrinter Method

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.SetDataSource(this.salesDataSet);
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
2 18016
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
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.ApplyPageMargins(pageMargins);
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeti | last post by:
how to show Print Preview window using Crystal reports? I've created report, filled it with text and data, and I can print it using PrintToPrinter method, but i'd like to show Print Preview...
2
by: Alberto | last post by:
1) How can I say to the crystal report viewer the number of copies? 2) How can I set the page configuration to horizontal? thank you
0
by: Nicola George | last post by:
Hi all, I hope someone can help me as I'm going a bit metal with this problem. I have a project in ASP.NET, within this project I have Crystal Report called Catalogue. On an asp page I have a...
4
by: mike | last post by:
Printer - HP4300 in 3 different locations. VB.Net Calling crReportObject.PrintToPrinter(iRptCopies, True, 1, -1) doesn't always return. We have had at least 4 cases now where the printers...
0
by: Anne-Marie Buki via .NET 247 | last post by:
Hi, I'm having problemes printing with Crystal Reports using VB.NET.Whenever I try printing on the local printer, when I don'tspecify a PrinterName, everything works fine. However, when Ichange the...
2
by: Paul Daly (MCP) | last post by:
Hello, I have an application that uses the version of CR.NET that came with VS.NET 2003. The CrystalReportViewer control prints the report fine when initiated by the user on the form, but I...
13
by: ATJaguarX | last post by:
I have a Zebra S500 and multiple S600 label printers. http://www.zebra.com/id/zebra/na/en/index/products/printers/industrial_commercial/s600.html They are currently being used in our legacy...
0
by: dolphinearth | last post by:
Hi all. I hope some of the smart fellow programmers can help me, please. The problem is I use Crystal Reports that was shipped out with VS 2005 .Net, and for some strange unknown reason, the...
0
by: WaluigiCubed | last post by:
Hi All, I just have a quick question about programmatically setting the paper tray that a Crystal Report prints to using Visual Basic .NET 2005 (The Crystal Reports version is the version that is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.