UI Loading Cystal Reports 2008 ActiveX Viewer into SAP B1
I have been looking over Code Samples, Help Forums and documentation from Business Objects for pas 5 hours. I made this work with VS2003 and CR10 but now im running VS2005 with CR2008.
Here is my code; It crashes on the bold line with the message: "Invalid cast".
The report is there and valid.
It does not even connect to a database; it has one text field in the header containing "Helloworld"
Oh and one more thing; i dont have this class CRAXDDRT. Im assuming that the class was stopped at CR11...
Public Class cCRViewer
Protected oForm As SAPbouiCOM.Form
Protected oDataSources As SAPbouiCOM.UserDataSources
Protected WithEvents oCRViewer As CrystalActiveXReportViewerLib12.CrystalActiveXReportViewer
Public ocr As New ReportDocument
Public Sub New()
Dim oActiveX As SAPbouiCOM.ActiveX
Dim oItem As SAPbouiCOM.Item
oForm = oApplication.Forms.Add("NewClass", SAPbouiCOM.BoFormTypes.ft_Sizable, "900201")
oDataSources = oForm.DataSources.UserDataSources
oItem = oForm.Items.Add("Viewer", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)
oActiveX = oItem.Specific
oActiveX.ClassID = "CrystalReports12.ActiveXReportViewer.1"
oCRViewer = oActiveX.Object
oCRViewer.ReportSource = ocr
oForm.Visible = True
Catch ex As Exception
Edited by: Denis Doiron on Sep 24, 2008 8:17 PM
Edited by: Rui Pereira on Dec 23, 2008 2:44 PM