umut çelik

umut çelik

  • NA
  • 4
  • 5.2k

c# Reportviewer Parameter

Dec 5 2018 5:50 AM
I want to show the textbox values ​​on Form1 that I have placed in Form 2 for Reportviewer. I get an example on the Internet or I can help you get an error as shown in the picture below in the code I wrote in my application. Thanks.
  1. Form1 frm = new Form1();  
  2.         private void Form2_Load(object sender, EventArgs e)  
  3.         {  
  4.   
  5.             this.reportViewer1.RefreshReport();  
  6.   
  7.         }  
  8.   
  9.         private void PassReport()  
  10.         {  
  11.   
  12.   
  13.             ReportParameter[] allPar = new ReportParameter[3]; // create parameters array  
  14.             ReportParameter parSum = new ReportParameter("Sum""195");  
  15.             ReportParameter parDiscount = new ReportParameter("discount""19");  
  16.             ReportParameter parTotal = new ReportParameter("total""176");  
  17.   
  18.             allPar[0] = parSum; //assign parameters to parameter array  
  19.             allPar[1] = parDiscount;  
  20.             allPar[2] = parTotal;  
  21.              
  22.             reportViewer1.LocalReport.SetParameters(allPar); // set parameter array  
  23.              
  24.             
  25.         }  
  26.   
  27.         private void reportViewer1_Load(object sender, EventArgs e)  
  28.         {  
  29.             PassReport();  
  30.         }  

Answers (5)