Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Reports Hangs up... ??? Post Reply Post New Topic
Author Message
TkNeo
Newbie
Newbie


Joined: 12 Jun 2008
Online Status: Offline
Posts: 11
Quote TkNeo Replybullet Topic: Reports Hangs up... ???
    Posted: 12 Jun 2008 at 9:05am
ok this is the craziest thing i have seen in a long time...

I have a form where users can specify a bunch of choices. When they hit the button to view the report, i create a new report object and customize its settings programmaticaly and point the report viewer to this new object. Now it works fine the first time users run the report. But when they run it the 2nd 3rd 4th .... time, one of these times, the report hangs up. It doesn't matter what they have chosen. The report just hangs up for no reason.

Here is the customization i am doing
http://msdn.microsoft.com/en-us/library/aa288421(VS.71).aspx

Dim FieldDef As FieldDefinition
FieldDef = myReportObject.Database.Tables.Item(0).Fields.Item(comboBox1().Text)
myReportObject.DataDefinition.Groups.Item(0).ConditionField = FieldDef

The report hangs up on the last line.....

By playing around for a while. I added a Threading.Thread.Sleep(2000) so the code now looks like

Dim FieldDef As FieldDefinition
FieldDef = myReportObject.Database.Tables.Item(0).Fields.Item(comboBox1().Text)
Threading.Thread.Sleep(2000)
myReportObject.DataDefinition.Groups.Item(0).ConditionField = FieldDef

Now it works most of the time but every once in a while it still hangs up...

Anyone know what is going on ????

Pls advise..

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 18 Jun 2008 at 3:41pm

Are you explicitly disposing the existing report object prior to creating a new one?  If not, I suggest that you try that.  Crystal is using COM objects in the background so they can be memory hogs and autmatic memory management is not always very good at cleaning them up efficiently.  We had some similar problems with reports hanging in our web app that were resolved when we started doing report.dispose(); prior to creating a new report object in the same variable.  We also dispose the report when the form closes.

-Dell
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.031 seconds.