private void btnView_Click(object sender, EventArgs e) { try { ReportDocument document = new ReportDocument(); string path = string.Empty; if (VoucherType == "BP" || VoucherType == "BR") // Bank Voucher { path = Application.StartupPath + "/rpt/Accounts/rptBankVoucher.rpt"; } else { path = Application.StartupPath + "/rpt/Accounts/rptVoucher.rpt"; } document.Load(path); DataTable dtReport = new DataTable(); if (VoucherType == "BP" || VoucherType == "BR") // Bank Voucher { dtReport = manageAccount.GetReportBankVoucher(txtFromVoucherNumber.Text, txtToVoucherNumber.Text, dtpFrom.Value, dtpTo.Value, this.VoucherType); } else { dtReport = manageAccount.GetReportVoucher(txtFromVoucherNumber.Text, txtToVoucherNumber.Text, dtpFrom.Value, dtpTo.Value, this.VoucherType); } document.SetDataSource(dtReport); Utility.SetReportDefaultParameter(ref document); CrViewer.ReportSource = document; CrViewer.Refresh(); } catch (Exception ex) { } }