private void btnPreview_Click(object sender, EventArgs e) { try { DateTime vDateTo = DateTime.Today.Date; // DateTime.Today.Date.Month.ToString() + "/" + DateTime.Today.Date.Day.ToString() + "/" + DateTime.Today.Date.Year.ToString(); Reports.RptReportViewer vForm = new Reports.RptReportViewer(); vDateTo = dt_Till.Value; //dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString(); //DataTable dt = objDAL.getPartyLedger(vPartyID, dt_From.Value.Month.ToString() + "/" + dt_From.Value.Day.ToString() + "/" + dt_From.Value.Year.ToString(), dt_ToDate.Value.Month.ToString() + "/" + dt_ToDate.Value.Day.ToString() + "/" + dt_ToDate.Value.Year.ToString()); DataTable dt = objDAL.getPartiesRecPay(vDateTo.ToShortDateString(), false); if (dt.Rows.Count == 0) { MessageBox.Show("No Data To Display", "No Data"); return; } vForm.ShowRecPay(vDateTo, false, dt); vForm.ShowDialog(); } catch (Exception exc) { MessageBox.Show(exc.Message, "Error"); } }