Crystal Reports Viewer in .Net GUI - Forum - OpenEdge Development - Progress Community

Crystal Reports Viewer in .Net GUI

 Forum

Crystal Reports Viewer in .Net GUI

  • I am trying to use a Crystal 10 viewer in a form but I'm not sure what to use in the Advanced GUI tools. OCX or can I use a .dll?

    Any ideas?

  • The first thing I would try is to install the Crystal .NET runtime and google some C# examples and try something similar in ABL.

  • Well, I did find an example of adding the Crystal Report Viewer to a C# application. I have a copy of Visual Studio 2005 and was able to add a copy of the control to the windows form. What VS2005 does is add a bunch of references which, as of yet, I'm not able to duplicate.

    Although, I'm posting this as more of an update any additional information would gladly be accepted.

  • Visual Studio 2005 and was able to add a copy of the

    control to the windows form. What VS2005 does is add

    a bunch of references which, as of yet, I'm not able

    to duplicate.

    Do you have a sample of those?

  • Well, I guess it's not a lot of them but I am showing references to AxCrystalActiveXReportViewerLib10 and CrystalActiveXReportViewerLib10.

  • Hello John,

    I may have some suggestions but I need to understand your environment.

    Do you have the CrystalReportViewer control for .NET?

    Do you see the control in the CrystalDecisions.Windows.Forms assembly with the Object Browser in Visual Studio 2005?

    How are you trying to use the control in a form?

    How are you creating the reports?

    I have been able to use the CrystalReportViewer. I used the CrystalReportViewer control in an ABL user control and then embed the ABL user control in an ABL form. I added an ABL property to expose the ReportSource property to the Visual Designer in OpenEdge Architect.

    I had to add the CrystalDecisions.CrystalReports.Engine and the CrystalDecisions.Windows.Forms assemblies to assemblies.xml file.

    I am attaching the wrapper program ReportViewer.cls in case that it is useful. Please consider that I wrote it for a test and it may need some improvements.

    ReportViewer.cls

    I hope this helps.

  • Well, I have the Crystal 10 Runtime installed. And I am just trying to use the viewer to view pre-created reports. Hope that answers your question.

    I will take a look at your code. Thank you for that.

  • Sorry I'm pretty new to this stuff.

    So you just added the entries to the assemblies.xml but do you have Version, Culture, and PublicKeyToken information? I've never used an ABL User Control either so I need to check that out too.

  • You can modify the assemblies.xml file with the Assembly References Tool (menu OpenEdge, Tools, Assembly References).

    It should be possible to add the Crystal Reports Viewer to you Toolbox (right mouse click, Add Controls, Global Assemblies, Filter on "Crystal").

  • I must have done something wrong then because the Crystal isn't showing up in my Global Assemblies list.

    Can I do this with just the Crystal Runtime? I can't remember.

    Message was edited by:

    John Gawlik

    Dumb question, I just did it with my Visual Studio machine.

    Message was edited by:

    John Gawlik

  • They should be there!

    I tried it myself and installed CRRedist2005_x86.msi (CRRedist2008_x86.msi should work as well I think).

    Used the Assembly References Tool to add the Crystal references. Saved the new assemblies.xml file in the project root.

    Tried to add the CR Viewer to the Toolbox but then I got the error "Visual Designer does not support this controls" or something like that. You should probably wrap the CR viewer in an ABL Control like said earlier?

    I could however create a Form and add the following code to visualize the CR Viewer (based on the code that was posted earlier).

    DEFINE VARIABLE crystalReportViewer1 AS CrystalDecisions.Windows.Forms.CrystalReportViewer NO-UNDO.

    crystalReportViewer1 = NEW CrystalDecisions.Windows.Forms.CrystalReportViewer().

    crystalReportViewer1:ActiveViewIndex = -1.

    crystalReportViewer1:BorderStyle = System.Windows.Forms.BorderStyle:FixedSingle.

    crystalReportViewer1:Dock = System.Windows.Forms.DockStyle:Fill.

    crystalReportViewer1:Location = new System.Drawing.Point(0, 0).

    crystalReportViewer1:Name = "crystalReportViewer1".

    crystalReportViewer1:SelectionFormula = "".

    crystalReportViewer1:Size = new System.Drawing.Size(420, 320).

    crystalReportViewer1:TabIndex = 0.

    crystalReportViewer1:ViewTimeSelectionFormula = "".

    Controls:Add(crystalReportViewer1).

  • Some screenshots. Hope this helps.

  • Well, I will try reinstalling the runtime then. I have an older version: CR10RDC.msi.

    No luck...I wonder if it's version issue. We've never really bothered to upgrade from version 10.

    Message was edited by:

    John Gawlik

    Neither my 10.1B machine or my 10.2A machine show Crystal Decisions of any kind in the Windows\assembly. I'm guessing that this might be related to the older version of the redistributable.

    Message was edited by:

    John Gawlik

  • It seems that the runtime that you have, only includes the OCX version of the viewer.

    If you can use a version of the runtime with the .NET version of the viewer then you could integrated it using the sample program from before.

    Another option would be to use the OCX in an ABL window embedded in a .NET form.

    See the chapter about "Embedding ABL windows in .NET forms" in the OpenEdge GUI for .NET guide.

    I hope this gives you some ideas.

  • I am currently downloading 11.2 right now and see if I have any better luck. I will definitely check into using the OCX as suggested. Fortunately, my boss is open to the idea of updating Crystal since we've put it off for so long.

    Thank you all for you suggestions. I'll get this working one way or the other.