Skip to Content
0
May 12, 2010 at 07:44 AM

How to embed Crystal Reports viewer in a B1 Form.

606 Views

Hi,

i'm trying to embed Crystal Reports viewer in a B1 Form, but i'm having troubles.

I'm using:

- Visual Studio 2008

- SAP Business One 8.8 SP: 00 PL: 09

I've already took a look at other threads but haven't found a solution.

I'm using ActiveX feature like this:

        Dim Actx As SAPbouiCOM.ActiveX
        Dim oItem As SAPbouiCOM.Item

        oItem = Form.Items.Add("CrViewer", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)
        oItem.Left = 5
        oItem.Top = 5
        oItem.Width = 250
        oItem.Height = 200

        ' Create the new ActiveX control
        Actx = DirectCast(oItem.Specific, SAPbouiCOM.ActiveX)
        Actx.ClassID = "{548C6316-751F-4B34-B8D9-A56FCEE53BC8}" 'Corresponds to Crystal ActiveX Report Viewer Control 10.5
        Actx.Object.ReportSource = r 'r is my CrystalDecisions.CrystalReports.Engine.ReportDocument already prepared

When i set the ReportSource property i got this exception:

System.Runtime.InteropServices.COMException (0x80020003): Impossibile trovare membro. (Eccezione da HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))

in Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateSet(Object o, Type& objType, String name, Object[] args, String[] paramnames, Boolean OptimisticSet, CallType UseCallType)

in Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean OptimisticSet, Boolean RValueBase, CallType CallType)

in Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSetComplex(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean OptimisticSet, Boolean RValueBase)

Seems that ReportSourceProperty does not exists, but im' sure that it exists!!

In fact, if in the immediate windows i type:

 ? Actx.Object.ReportSource

I receive Nothing! so the property is accessible.

I really cannot make it work, can anyone help please?

Thanks

Paolo