I have this code that I never tried to preload CR assemblies:
> > 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(CrystalRepor
>
> 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
>
Main Topics
Browse All Topics





by: hertzgordmanPosted on 2009-07-05 at 07:58:55ID: 24780193
Here is my code for just creating an instance of the form and refreshing the viewer:
)
ser();
eName = @"C:\Database\LoanTrack\Lo anWithDefe rredIntere st.rpt";
werRefesh( );
);
private void OpenReportViewerInvisible(
{
// Open Report for USER
MonthReport1Form MyForm = new MonthReport1Form();
{
try
{
// UserName
MyReports MyReportsClass = new MyReports();
string UserName = MyReportsClass.GetWindowsU
MyForm.FormParam_UserName = UserName;
MyForm.FormParam_ReportFil
this.Cursor = Cursors.WaitCursor;
// Refresh the viewer
MyForm.MonthReport1FormVie
// Cursor off
this.Cursor = Cursors.Default;
// Close the form
MyForm.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message
}
}
}