Tuesday, July 23, 2013

Dummy data in Crystal Report at runtime

When using Crystal Reports, in Design mode, you preview your report by clicking "Main Report Preview".

To bind the report I use:
crDaily1.SetDataSource((DataTable)dtDaily);
crDaily1.SetParameterValue("pPeriod", title);

If I put this code in
private void FormReportDaily_Shown(object sender, EventArgs e)
sometimes the dummy data that appears in "Main Report Preview" is shown at runtime. I really don't know the reason?!.

Resolution:

Put the binding code
crDaily1.SetDataSource((DataTable)dtDaily);
crDaily1.SetParameterValue("pPeriod", title);

in the constructor:
public FormReportDaily()

No comments: