try { if (e.ColumnIndex == 8) { //check id value for current row if (dataGridView1.CurrentRow.Cells[8].Value != null) { ReportDocument cryRpt = new ReportDocument(); RPT_CautionDeposit rptvt = new RPT_CautionDeposit(); PrintCautionDeposit pcd = new PrintCautionDeposit(); cryRpt.Load(@"C:\Reports\RPT_CautionDeposit.rpt"); TextObject text = (TextObject)cryRpt.ReportDefinition.Sections["Section3"].ReportObjects["Text12"]; TextObject text1 = (TextObject)cryRpt.ReportDefinition.Sections["Section3"].ReportObjects["Text11"]; TextObject text2 = (TextObject)cryRpt.ReportDefinition.Sections["Section3"].ReportObjects["Text10"]; TextObject text3 = (TextObject)cryRpt.ReportDefinition.Sections["Section3"].ReportObjects["Text17"]; TextObject text4 = (TextObject)cryRpt.ReportDefinition.Sections["Section3"].ReportObjects["Text14"]; TextObject text5 = (TextObject)cryRpt.ReportDefinition.Sections["Section3"].ReportObjects["Text16"]; text.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); text1.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); text2.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); text3.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString(); text4.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString(); text5.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); pcd.CRV_CautionDeposit.ReportSource = cryRpt; pcd.CRV_CautionDeposit.Refresh(); pcd.ShowDialog(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)