Angel Princess

Angel Princess

  • NA
  • 100
  • 45.4k

How to print datetimepicker to crystal report?

Jul 17 2015 5:22 AM
CommPercent objC = new CommPercent();
objC.MdiParent = this.MdiParent;
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("Date", typeof(String));
dt.Columns.Add("OPDNo", typeof(Int32));
dt.Columns.Add("Patientname", typeof(String));
dt.Columns.Add("Group", typeof(String));
dt.Columns.Add("Test", typeof(String));
dt.Columns.Add("Result", typeof(String));
dt.Columns.Add("Units", typeof(String));
dt.Columns.Add("Cost", typeof(Decimal));
dt.Columns.Add("Comm", typeof(Decimal));
foreach (DataGridViewRow dgr in dgv_Patients.Rows)
{
dt.Rows.Add(dgr.Cells["Date"].Value, dgr.Cells["OPDNo"].Value, dgr.Cells["Patientname"].Value, dgr.Cells["Group"].Value, dgr.Cells["Test"].Value, dgr.Cells["Result"].Value, dgr.Cells["Unit"].Value, dgr.Cells["Cost"].Value, dgr.Cells["Comm"].Value);
}
ds.Tables.Add(dt);
CommisionPercent cr = new CommisionPercent();
cr.SetDataSource(ds);
objC.crystalReportViewer1.ReportSource = cr;
objC.crystalReportViewer1.Refresh();
objC.Show();
 
This is for datagridview. I also want to print FromDate and ToDate from datetime picker. How to do it? 

Answers (3)