473,385 Members | 2,180 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,385 software developers and data experts.

PrintToPrinter fails - Index out of range

I have two very similar applications running on the same development
machine. One prints correctly, the other fails with an "Index out of
range" exception.

Here's the code for the one that fails. Believe me, it's exactly
identical except the name of the report and the data in the dataset.
It barfs on the last line:

Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
Dim ds As New DataSet
Dim rptName As String
Dim intEndPageNo As Integer
Dim strCaseMessage As String = " "
Dim mstrMessage As String

Try
rptName = "rptQuery.rpt"

ds = SqlHelper.ExecuteDataset(ConfigSettings.SystemConn ectionString,
CommandType.StoredProcedure, "stpGetQueriesForReport", New
SqlParameter("@CSIDs", LogonUser.CSIDsForReport))
ds.Tables(0).TableName = "stpGetQueriesForReport"

rpt = New CrystalDecisions.CrystalReports.Engine.ReportDocum ent

rpt.Load(LogonUser.CrystalReportPath & rptName)

rpt.SetDataSource(ds)

rpt.PrintOptions.PrinterName = mstrPrinterName

rpt.PrintOptions.PaperOrientation =
CrystalDecisions.[Shared].PaperOrientation.Landscape

rpt.PrintToPrinter(CType(Me.cboNumCopies.SelectedI tem.Value, Integer),
False, 0, 0)

If I replace the last line with literals it STILL barfs:

rpt.PrintToPrinter(1, False, 0, 0)

Anyone have any thoughts? The full error message (as slightly
manipulated by my application to display to the user) is below:

Thanks

Edward

There was a problem in printing. Please contact your system
administrator. Number: CrystalDecisions.CrystalReports.Engine
Message: Index was outside the bounds of the array. Stack Trace: at
CrystalDecisions.CrystalReports.Engine.Migration.P rintOptionsConverter.EROMPaperSourceToDNETPaperSou rce(CrPaperSourceEnum
ePaperSource) at
CrystalDecisions.CrystalReports.Engine.PrintOption s.get_PaperSource()
at
CrystalDecisions.CrystalReports.Engine.PrintOption s.CopyTo(PrinterSettings
printer, PageSettings page) at
CrystalDecisions.CrystalReports.Engine.FormatEngin e.PrintToPrinter(Int32
nCopies, Boolean collated, Int32 startPageN, Int32 endPageN) at
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.PrintToPrinter(Int32
nCopies, Boolean collated, Int32 startPageN, Int32 endPageN) at
CQDB_WIP.PrinterSelectionForm.PrintQUERYReport() in
c:\inetpub\wwwroot\CQDB_vs2003\forms_misc\PrinterS electionForm.aspx.vb:line
208"

Mar 23 '06 #1
0 1888

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: info | last post by:
I am pasting in a recordset from access to an excel sheet via VBA successfully. Then my routine copies a range of cells and pastes them into another range, this works fine every other time it...
2
by: Alx Sharp | last post by:
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: ...
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: teddysnips | last post by:
I have two very similar applications running on the same development machine. One prints correctly, the other fails with an "Index out of range" exception. Here's the code for the one that...
10
by: siasookhteh | last post by:
I also posted this in Django Users group, but figured it probably has more relevance for python group. It seems like a freak problem to me. I spent a long hour to track the problem down and...
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...
1
by: Derek | last post by:
I am having problems with the PrintToPrinter command. It works fine in the development environment but when I try using this on the web server it does not work. I am having problems debuging...
85
by: Russ | last post by:
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.