Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: "Object not set to an instance" error in GetPage Post Reply Post New Topic
Author Message
wanderingbob
Newbie
Newbie
Avatar

Joined: 12 Dec 2007
Location: United States
Online Status: Offline
Posts: 9
Quote wanderingbob Replybullet Topic: "Object not set to an instance" error in GetPage
    Posted: 18 Jan 2008 at 3:30pm
Greetings all,
 
I am integrating Crystal Reports XI into a large VB.NET 2005 application.  I don't use the integrated report designer in VB.NET; I design the reports in the Crystal Reports XI environment, integrate them into a VB.NET assembly, then use the integrated crystal reports viewer (crv) to display the reports.  The app runs against an Oracle 10g database.
 
I have a report that includes two subreports, both in separate group footers.  The report worked perfectly until I changed the "New Page After" option in the Section Expert for the group footer that includes the first of the two subreports.
 
That's the only change I made, but now the report is initially displayed without incident, displaying the first page, but when the user tries to navigate to the second page (the one that would include the first of the two subreports, for which I set the "New Page After" option in Section Expert), a runtime exception occurs in the crv control.  The exception is as follows:
 
Exception.Message: "Object not set to an instance of an object"
Source: "CrystalDecisions.CrystalReports.Engine"
    StackTrace: "   at CrystalDecisions.CrystalReports.Engine.ReportDocument.get_IsLoaded()
   at CrystalDecisions.ReportSource.NonHTTPCachedReportSource.GetReport(RequestContext context, Boolean bAddToCacheWhenCreated)
   at CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext)
   at CrystalDecisions.Windows.Forms.MainReportDocument.GetPage(PageRequestContext context)"
 
The user can navigate to later pages, then back to the first page, without incident, but any attempt to get this particular page - whether viewing the report, saving it to disk, or printing - generates this exception.
 
I would appreciate any information as to what is causing this error and how to work around it.
 
Thanks in advance,
Bob
 
Any sufficiently advanced technology is indistinguishable from magic
IP IP Logged
wanderingbob
Newbie
Newbie
Avatar

Joined: 12 Dec 2007
Location: United States
Online Status: Offline
Posts: 9
Quote wanderingbob Replybullet Posted: 21 Jan 2008 at 1:52pm
Update on this issue:
 
Before I inherited the project, the following lines of code were being executed after the Crystal Report viewer was loaded:
 

crv.ShowLastPage()

crv.ShowFirstPage()

 

If I comment both lines of code out, the result is aPure virtual function call” exception and the report is not displayed.

 

If I comment out ShowFirstPage, so that only ShowLastPage remains, the bug remains – being unable to view any pages other than the first and the last page.

 

If I comment out ShowLastPage, so that only ShowFirstPage remains, it’s even worse – only the first page can be displayed, and the last page plus any other pages you attempt to display result in an error.



Edited by wanderingbob - 28 Jan 2008 at 12:20pm
Any sufficiently advanced technology is indistinguishable from magic
IP IP Logged
wanderingbob
Newbie
Newbie
Avatar

Joined: 12 Dec 2007
Location: United States
Online Status: Offline
Posts: 9
Quote wanderingbob Replybullet Posted: 28 Jan 2008 at 12:18pm
If anyone is interested, I never found any information on these errors in the Crystal Reports documentation, on the web, or anywhere else, but this is how I worked around the problem:
 
If ds IsNot Nothing Then
    CrystalReport.SetDataSource(ds)
    crv.ReportSource = CrystalReport
    crv.ShowLastPage()
    crvPageNumber = crv.GetCurrentPageNumber()
    crv.ShowFirstPage()
Do
    crv.ShowNextPage()
Loop Until crv.GetCurrentPageNumber = crvPageNumber
 
End If
 
This forces the Crystal Reports viewer to programmatically preview every page in the report before the user has a chance to navigate to any page manually.  I feel that it should not be necessary to do this, but apparently it is. 
 
P.S.  I was running Crystal Reports XI Release 2 when this problem occured, and I applied the Crystal Report for .NET 2005 update, recommended in this forum, without any effect on this issue.
Any sufficiently advanced technology is indistinguishable from magic
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Jan 2008 at 12:25pm
Thanks for the update. I'm making a note of this to talk to the BOBJ tech support about it. See if it can be resolved without the coding you had to go through.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Jan 2008 at 12:28pm
Also, I was wondering if you are putting this code in the Page_Init() event?
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.