|
-
May 19th, 2008, 11:50 AM
#1
Thread Starter
Junior Member
Crystal Report Custom PaperSize problem migrating from vb 2005 to 2008
Hi, I'm having a problem in switching from VB 2005 to vb 2008. I have this set of codes which I use to customized the paper size to be printed:
Dim rdTxn As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim PkSize As New System.Drawing.Printing.PaperSize
Dim PrintDoc As New Printing.PrinterSettings
rdTxn.Load("cr1.rpt")
rdTxn.SetDataSource(data1)
PkSize = PrintDoc.PaperSizes.Item(My.Settings.PapersizeID)
rdTxn.PrintOptions.PrinterName = "Name of printer"
rdTxn.PrintOptions.PaperSize = CType(PkSize.RawKind, CrystalDecisions.Shared.PaperSize)
rdTxn.PrintToPrinter(1, False, 1, 1)
With converting the project to vb 2008 this particular line is causing an error:
rdTxn.PrintOptions.PaperSize = CType(PkSize.RawKind,CrystalDecisions.Shared.PaperSize)
The error says:
Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
I believe its pointing to the Pksize.Rawkind which seems to be returning an invalid value.
I felt it strange cause I tried the similar codes in VB 2005 and it's been working as it did before. Did anybody ran into the same problem? Is the new Crystal report in vb 2008 not compatible? I couldn't find a similar problem from other people, perhaps nobody has encountered it or am I missing something? Any help will be appreciated. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|