Ejemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            companyNameReport rpt = new companyNameReport();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void report_Click(object sender, EventArgs e)
        {
            printSaleForm        printForm = new printSaleForm();
            medicalStoreDataSet6 dataSet   = new medicalStoreDataSet6();

            dataSet.EnforceConstraints = false;

            companyNameReport report = new companyNameReport();

            try
            {
                DataTable dt = new DataTable();
                foreach (DataGridViewRow row in this.dataGridView1.Rows)
                {
                    DataRow dr = dt.NewRow();

                    if (row.DataBoundItem != null)
                    {
                        dr = (DataRow)((DataRowView)row.DataBoundItem).Row;

                        dataSet.companyName.ImportRow(dr);
                    }
                }

                report.SetDataSource(dataSet);

                printForm.crystalReportViewer1.ReportSource = report;
                printForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }