cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports Viewer locks up when called from vb.net

Former Member
0 Kudos

I have used Crystal Reports with Visual Studio for several years without a problem.  All at once, I have one program that will no longer display the form in the viewer.  The form uses an XML document for data and creates a graph and reports on other data.  It will print the form from vb.net, it will create a pdf from the vb.net, but when you call for a preview, it will show the beginning view of the Crystal Viewer, the wait cursor on the viewer will spin once and stop.  It doesn't make any difference if there is a lot of data or little data sent via the xml.  There is no error message.  It just stops.  If you open the report in Crystal Reports itself, it will preview without a problem.  I currently have in excess of 60 reports that are created on the same Visual Studio or Crystal Reports (2008) (some written before/Some after) that use the same basic code and work without fail.

Visual Studio Crystal Viewer...

Crystal Reports Preview...

Where do I look for an error and for What?

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Pat

I suppose the first thing to investigate is; what changed? May sound flip, but it is not neat to be as such. E.g.; new apps installed? Updates, etc.

You mention Crystal Reports 2008, but no the Service Pack. updating to the latest SP will certainly not hurt. However you will have to contact sales in order to get it. Sales ph: 866-681-3435. Ask them for the link to the SP as well as the associated MSM and / or MSI file - which ever you prefer when deploying the app.

A few other things to try:

Enable the option Verify on 1st refresh

Try a different printer driver as default

Run Process Monitor, see if the logs tell you anything

Let me know what database you are using and the version of the client used

Also, how are you connecting to the db

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

Program is using Visual Studio 2013

The only changes made was within the VS program to point to a new sql server we are bringing on line to replace an old one. No changes in data structure etc.


  • Enable the option Verify on 1st refresh - This is what it has/had
  • Try a different Print Driver - No change in problem
  • The database used is a dataset created in VS.net then passed to the Crystal Report via script.  The report was created by using the dataset to create an XML then using the ADO(XML)  (See script example below)
  • I downloaded and installed the SP-12 update.  Things may run a little faster now but the result is the same.

        Dim aReportTitle As String
        Dim ReportDay As Integer = (CDate(dtpEndDate.Text)).Day
        aReportTitle = "WilbirEval-" & Month(CDate(dtpEndDate.Text)).ToString & "-" & ReportDay.ToString & "-" & Year(CDate(dtpEndDate.Text))

        Dim myPrinterName As String = CurrPrinter
        Dim frmPrintPreview1 As New frmPrintPreview
        Dim crWilbirEval1 As New crWilbirEval
        If WilbirEvalDS.Tables("WilbirEval").Rows.Count = 0 Then
            MsgBox("No Records Found")
            lblCreate.Visible = True
        Else
            crWilbirEval1.SetDataSource(WilbirEvalDS)
            crWilbirEval1.Refresh()
            crWilbirEval1.SummaryInfo.ReportTitle = aReportTitle
            If rdoPreview.Checked = True Then
                frmPrintPreview1.CrystalReportViewer1.ReportSource = crWilbirEval1
                frmPrintPreview1.ShowDialog()
            ElseIf rdoPrint.Checked = True Then
                crWilbirEval1.PrintOptions.PrinterName = myPrinterName
                crWilbirEval1.PrintToPrinter(1, False, 0, 0)
            ElseIf rdoPDF.Checked = True Then
                crWilbirEval1.ExportToDisk(ExportFormatType.PortableDocFormat, txtPDFFileName.Text)
                MsgBox("PDF was Created: --  " & txtPDFFileName.Text, MsgBoxStyle.Information, "PDF Created")
            End If
        End If
        WilbirEvalDS.Clear()
        frmPrintPreview1.Close()
        BackgroundWorker1.CancelAsync()
    End If
former_member183750
Active Contributor
0 Kudos

See if commenting this out will help:

crWilbirEval1.Refresh()

And where is the report load?

- Ludek

Former Member
0 Kudos

Good Morning Ludek,

Commented it out - No change in report preview

The report load?!?  - The report has been created in Crystal Reports and included in the Visual Studio project with the name "crWilbirEval"

Dim crWilbirEval1 As New crWilbirEval

The data is passed with 'SetDataSource'

crWilbirEval1.SetDataSource(WilbirEvalDS)


The Preview is called with...

Dim frmPrintPreview1 As New frmPrintPreview

and

frmPrintPreview1.CrystalReportViewer1.ReportSource = crWilbirEval1


I have even done the unthinkable and rebooted the computer (ha).

0 Kudos

Hi Pat,

If you were using your code in the Page_Load event move it to the Page_Init section. Changes in the Section to load standards were updated so you must load your report in the Page_Init section now.

Also some general requirements, use Sessions and Post-back methods to keep the page active. Sessions to keep the PrintJob in focus and Post-back to use the same session so it does not run the report each time for each page.

Try using Fiddler to see what your page is actually doing also...

Another possible issue is the CR resources for rendering Charts is not available. Try a simple report, no database in it and just a text object with "Hello World" to remove all dependencies from the report.

Don

Former Member
0 Kudos

I have finally succeeded in getting my report to be created.  My problem is apparently a problem with my use of a "backgroundWorker" to run it asynchronously.  Once I removed it, it does work, but I loose the the benefits of the async.  I have tried many ways to reinstall it but to no avail.  Due to the complexity of the report, it does take quite a while to load and display, if in the mean time the mouse is moved etc. the window freezes and it shows "Not Responding".  In reality, it is working fine and will eventually show once it has completed its build.  Not pretty, but it will work until I find another way.

Answers (0)