public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            memberDetailReport rpt = new memberDetailReport();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        private void rp_Click(object sender, EventArgs e)
        {
            reportViewer        report = new reportViewer();
            memberReportDataSet ds     = new memberReportDataSet();
            memberDetailReport  br     = new memberDetailReport();
            DataTable           dt     = new DataTable();

            foreach (DataGridViewRow item in this.dataGridView1.Rows)
            {
                DataRow dr = dt.NewRow();

                if (item.DataBoundItem != null)
                {
                    dr = (DataRow)((DataRowView)item.DataBoundItem).Row;
                    ds.DataTable1.ImportRow(dr);
                }
            }

            ds.DataTable1.Rows.RemoveAt(dataGridView1.Rows.Count - 1); //removing the last row because it contain total fine which is causing problem
            br.SetDataSource(ds);
            report.crystalReportViewer1.ReportSource = br;
            report.Show();
        }