Skip to Content
avatar image
Former Member

Report Document not show on Crystal Report Viewer in C#

My program is modified from VB.NET. Now I struck with Crystal Report that Crystal Report Viewer didn't show Report Document.

Printing code is composed of two forms. One assign parameters and objects need. Other is Crystal Report Viewer form, CrystalReportForm. Last one run report by parameter from the first.

When run this code that it didn't found any error but the problem is no report show on Crystal Report Viewer on second form. It just blank Crystal Report Viewer. There arm't any message response.

Here is my code.

// report caller form.
private void Print()
CrystalReportForm rptForm = new CrystalReportForm();
string[] strtbl;
strtbl = new string[1];
string[] strqry;
strqry = new string[1];
// prepare var
string myqry;
string myrpt;

// Pass The Table That you used in the crystal Report
strtbl[0] = "r_receipts";
// Pass the Query

myqry = "SELECT * FROM r_receipts";
myrpt = "rptReceipts.rpt";
strqry[0] = myqry;

//Pass For Mdi True
rptForm.MdiParent = this.ParentForm;
rptForm.ViewReport(myrpt, strtbl, strqry, "");
//Parameter Value It is Optional

// Crytal Report Viewer form.
public void ViewReport(string ReportName , string[] TableName, string[] QueryString , string Parameter = "")
//Me.MdiParent = mainpage;
if (TableName.Length != QueryString.Length )

MessageBox.Show("Passed Variable Are Not Correct", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
CrystalDecisions.Windows.Forms.CrystalReportViewer crv = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
crv.ActiveViewIndex = 0;
crv.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
crv.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
crv.Dock = System.Windows.Forms.DockStyle.Fill;
crv.Location = new System.Drawing.Point(0, 0);
crv.Name = "CrystalReportViewer";

MySqlDataAdapter at =new MySqlDataAdapter();
DataSet ds = new DataSet();
for (int i = 0; i < TableName.Length; i++)
at = GetDataAdeptor(QueryString[i]);
at.Fill(ds, TableName[i]);

string rptPath = "";
rptPath = Application.StartupPath + "\\" + ReportName;
if (Parameter != "")
rpt.SetParameterValue(0, Parameter);

crv.ReportSource = rpt;
Panel panel1 = new Panel();

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    May 19, 2014 at 11:51 AM

    What happens when you export the report from viewer, does the exported pdf show any data?

    as you are using dataset, this could also be an issue with DS.

    Could you print the data from DS to a datagrid and see if the DS actually returns the data.

    - Bhushan

    Senior Engineer

    SAP Active Global Support

    Follow us on Twitter

    Got Enhancement ideas? Try the SAP Idea Place

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 22, 2014 at 07:48 AM


    I already fixed it.



    Add comment
    10|10000 characters needed characters exceeded