C# and Crystal Reports XI (Release 2)

Apr 8 2009 9:12 AM

My Object is to call Crystal Reports XI class library including crystal Reports viewer.

What I did:

I create a class library with a window form and added crystal reports viewer. The following code is used.

[code under the window form]

public long init(object ReportObject, string strTitle, bool isMaximized)

        {

            Cursor.Current = Cursors.WaitCursor;

            this.Text = strTitle;

 

            this.crystalReportViewer1.ReportSource = ReportObject;            

            this.crystalReportViewer1.PrintReport();      

       

            if (isMaximized == true )

            {

                this.WindowState = FormWindowState.Maximized;

            }

 

 

            this.crystalReportViewer1.Zoom(100);

            Cursor.Current = Cursors.Default;       

            return (1);          

 

 

        }

[code under the .cs file]

public void ShowReport(ref object ReportObject, string strTitle, bool isMaximized)

        {

Crystal_Report_Viewer.Net.Report_Viewer Obj = new Crystal_Report_Viewer.Net.Report_Viewer();           

            Obj.Show();

            Obj.init(ReportObject, strTitle, isMaximized);

 

        }

This code seems to be ok but when I call a method ShowReport() from third party application, a meessage get appeard : invalid Report Source, can any expert help me out to resolve this issue. The following code I used in third party application after regersting assembly.

Obj = new CrystalViewer.Crystal();

Obj.ShowReport(CRReport,ReportTitle,false);

What should I do?