1 Attachment(s)
[2005] VB.Net -> Crystal Reports C++ Runtime Error
Hey Guys,
WOW BusinessObjects.com is unbelievably hard to navigate and find good info! Hence I pose my question to you learned folk…
I have an issue with Crystal Reports included with VS.Net 2005. Please see the screen shot of the error attached.
This error message is displayed when trying to view a report using the Crystal Reports viewer. I am using the push data method, i.e I create and populate a dataset and then ‘push’ it onto the report. I then set the report source for the viewer and call show for the form – all standard stuff. Now this all works beautifully BUT if I switch between other applications before the report is displayed I am greeted with this error message (attached):
Runtime Error!
Program: <AppPath>
R6025
-pure virtual function call
Upon clicking OK my whole app catastrophically fails, down she goes….
All the code is sitting inside Try, Catch, Finally blocks so any error produced by my code *should* be caught. Could anything about my code be provoking this situation?
Obvious answer: Don’t switch between apps! But the report can take up to a couple of minutes to display, users have work to do. Further more it should be possible just by principle – I mean that’s the whole reason behind a multitasking environment.
I attempted the obvious solution and went searching for any service packs or hot fixes but none have been released yet for 2005 (as far as I can see – please correct me if not).
Some code:
VB Code:
Private Sub ShowExecRpt()
Dim objRpt As New crExecRpt
Dim objExecData As xsExecRpt
'Gather the data
objExecData = cRptDataEngine.BuildExecData()
'Sort the data and push onto report
objRpt.SetDataSource(SortDataSet(objExecData))
'Set the print options
objRpt.PrintOptions.PaperSize = CrystalDecisions.[Shared].PaperSize.PaperA3
objRpt.PrintOptions.PaperOrientation = CrystalDecisions.[Shared].PaperOrientation.Landscape
'Display the report
ShowRpt(objRpt, "Executive Summary " & DateTime.Now.ToString(cMain.conDateFormat))
objRpt.Dispose()
objRpt = Nothing
If Not objExecData Is Nothing Then
objExecData.Dispose()
objExecData = Nothing
End If
End Sub
Public Shared Sub ShowRpt(ByVal objRpt As Object, ByVal sWindText As String, Optional ByVal sEndDate As String = "")
'Open the report form with window txt passed in. Set the report EndDate param to passed value.
Dim frmRptView As frmRptView
Dim paramField As CrystalDecisions.Shared.ParameterField
Dim discreteVal As CrystalDecisions.Shared.ParameterDiscreteValue
Dim paramFields As CrystalDecisions.Shared.ParameterFields
frmRptView = New frmRptView
frmRptView.MdiParent = cMain.frmMDIMain
Try
If sEndDate <> "" Then
discreteVal = New CrystalDecisions.Shared.ParameterDiscreteValue
discreteVal.Value = sEndDate
paramField = New CrystalDecisions.Shared.ParameterField
paramField.ParameterFieldName = "EndDate"
paramField.CurrentValues.Add(discreteVal)
paramFields = New CrystalDecisions.Shared.ParameterFields
paramFields.Add(paramField)
frmRptView.crView.ParameterFieldInfo = paramFields
End If
frmRptView.crView.ReportSource = objRpt
frmRptView.Text = sWindText
frmRptView.Show()
Catch ex As Exception
MessageBox.Show("An error occured while attempting to display the report." & vbCr & _
"The report cannot be displayed." & vbCr & vbCr & _
"Please contact your System Administrator.", "Marketing Reports", MessageBoxButtons.OK, MessageBoxIcon.Information)
cMain.WriteErrorLog("frmCampRpt::ShowRpt()" & vbTab & ex.Message)
End Try
End Sub
This code works EVERYTIME I keep focus on my app, if I switch to another app the error message is displayed right before the viewer actually renders the report. Its definately making it to 'frmRptView.Show()' because the form pops up, the viewers controls are all placed along the top and then BOOM error!
Tearing my hair out! Looks like it may be in the CR runtime? It occurs on my both my Dev machine and end users machines. Occurs when running from the IDE or exe on my Dev box. I have deployed the CR.Net 2005 merge modules to the client machines using an MSI built in VS2005.
Apologies for the length of the post but trying to provide as much info as possible.
Many thanks in advance for any suggestions, ideas or possible solutions.
Matt.
Re: [2005] VB.Net -> Crystal Reports C++ Runtime Error
OK apologies required from myself to you guys...
Looks like I have the wrong forum section.
Mods can you please delete/move my post to the reporting section where it should be?
Thanks,
Matt.
Re: [2005] VB.Net -> Crystal Reports C++ Runtime Error
Hey PPL!
After some time I have managed to track down what is causing my error and I am now trying to develop a work around. Turns out the CrystalReportViewer in 2005 has a flaw.
It has become more a of a general programming question so I redirect my question to this section again.
Please see thread:
http://www.vbforums.com/showthread.php?t=424469
I am trying to figure out how to dispose of my report object....
Thanks,
Matt