Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4891
  • Last Modified:

Speed up crystal report load

Hi!

I'm having problem with the speed regarding loading of a crystal report to the report viewer.

Can I speed this up,?

Is it possible the "load" crystal report when starting the application so the first report will be faster to load

I'm using the crystal report that are implemented in VS 2005
0
AWestEng
Asked:
AWestEng
  • 6
  • 5
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:


"JSantora" <John@ViridianTech.com> wrote in message
news:<1167268105.893451.45480@h40g2000cwb.googlegroups.com>...
> Charlie Brown wrote:
> > Is it possible to preload assemblies before they are called?  Each time
> > the first report in my app runs, it takes 10-15 secs while it loads the
> > appropriate assemblies, after that any report that is run appears
> > immediatly.

> Here you go...

> ' load up crystal when the app starts up.
> ' use a separate thread since its such a pig.
>             TraceWriteLine("starting Crystal Reports Thread")
>             myTimer = New FunctionTimer("load crystal")
>             Dim t As New Thread(AddressOf LoadCrystal)
>             t.Priority = ThreadPriority.BelowNormal
>             t.Start()
>             myTimer.EndTimer()
>             TraceWriteLine("...thread started")


> ' here's the code to load up a dummy report.
> ' this seems to load up and keep everything in memory throughout the
> life of the app.

>     Public Sub LoadCrystal()
>         crReport = New ReportDocument

>         Try
>             ' Need to preload crystal engine so the reports will print
> quickly throughout the rest of the application.
>             ' This report is not used, it is just loaded.  Testing so
> far 12/23/04 has not shown any
>             ' problems such as memory or print errors.
>             crReport.Load(CrystalReportFolder & "rptBlank.rpt")

>         Catch ex As Exception
>             DisplayException(ex, "Error: Could find the startup Crystal
> Report named 'rptBlank.rpt'." & _
>                vbCrLf & "If you are a new user, you may lack Server
> permissions to read this directory and file: " & CrystalReportFolder &
> "rptBlank.rpt" & _
>                vbCrLf & "Or the report may have been deleted or
> corrupted.  Please Call IT.  [EJS0412311300]")
>         End Try
>     End Sub

0
 
AWestEngAuthor Commented:
oki was there any more code in that thread?
0
 
Éric MoreauSenior .Net ConsultantCommented:
If you read the comments, you discover that they load a blank/dummy report just to have the DLLs in memory. It can also be done in a different thread.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AWestEngAuthor Commented:
It didn't help much to do that, it still takes alot of time to do the first report..

have i missed something.

I do this


 Public Sub New()

            Dim t As New Thread(AddressOf LoadCrystal)
            t.Priority = ThreadPriority.BelowNormal
            t.Start()
End sub

    Private Sub LoadCrystal()
        Dim crReport As New rptBlank

        Try
            crReport.Load()
        Catch ex As Exception
            Throw ex
        End Try
    End Sub
0
 
Éric MoreauSenior .Net ConsultantCommented:
are you loading this dummy report when the application is starting?
you may also load the form that has the CR viewer on it because it is loading other DLLs.
0
 
AWestEngAuthor Commented:
oki.. but that form is in tool that i dock to the main form, so how do I solve that?
0
 
Éric MoreauSenior .Net ConsultantCommented:
can't you just load the form without setting it to visible?
0
 
AWestEngAuthor Commented:
No i have stuff in the constuctor that sends stuff to the main form.

is there any other solution?
0
 
Éric MoreauSenior .Net ConsultantCommented:
you can create a different constructor specifically for that task or create a different dummy form to load CR viewer DLLs.
0
 
AWestEngAuthor Commented:
I can test that.

I alos tested this but htat didn't solve the problem either

    Private Sub LoadCrystal()
        Dim crReport As New rptBlank
        Dim crReportViewer As New CrystalDecisions.Windows.Forms.CrystalReportViewer

        Try
            crReport.Load()
            crReportViewer.ReportSource = crReport
        Catch ex As Exception
            Throw ex
        End Try
    End Sub
0
 
AWestEngAuthor Commented:
Hmm i tested to open the form load a report, close the form opened the form again and load the report.

it was not faster the seconds time,

But if i load the a seconds report to the viwer (and not close it between the loads) then the report load  very fast, so I wonder, can I get the process any faster then i already has?



0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now