Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WinForm
I am doing college project . In that they want bonafide certificate. For that i planned to pass textbox string to report.
 
I googled for passing parameter in winform. Then i got this step by step process. I implemented that using the following steps:
 
1: In Visual Studio 2010, open your .rdlc file, and open “Report Data” window (If you can not see this window, go to View menu to open it).
2: Right click the “Parameters” node, and add a new Parameter, ie: named it “content“.
3: In your .rdlc file, add a textbox, named it tbContent, and set its filed express to :
=Parameters!content.Value
4: Go to your Form file which include your reporterview control, and add the following code:
this.reportViewer1.LocalReport.ReportEmbeddedResource = “TestReport.Report1.rdlc”; ReportParameter rp = new  ReportParameter(“content”, this.textBox1.Text); 
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp }); this.reportViewer1.RefreshReport();
5: then you can pass the parameter from the TextBox on the form to .rdlc file;
 

I added the Microsoft.Reporting.WinForms; assembly reference and used the following code:

this.reportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc";
 
ReportParameter rp = new ReportParameter("content", this.textBox1.Text);
//Following line causes exception:
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
this.reportViewer1.RefreshReport();  
 
But it throws the following exception,
 
Local processing Exception was unhandled at the line:
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
.
 
Thanks in advance!
Posted 9-Jun-11 9:22am
Edited 9-Jun-11 9:29am
v2
Comments
EdMan196 at 9-Jun-11 14:32pm
   
Edited for: Readability, code formatting and grammer. <code> tags are for single lines of code, <pre> tags are for blocks of code and 'lang' attribute should be set - in your case 'cs' for CSharp (C#). Ed :)
Sagotharan Jagadeeswaran at 9-Jun-11 14:56pm
   
thank u@
Sagotharan Jagadeeswaran at 9-Jun-11 21:39pm
   
No solution :(
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I cant fix this bug. But i solve my problem,...
 
I got The Solution. Oh God, It take one day of my life.
 
I hope This solution is help, whom face the same problem in RDLC report.
 
ReportParameter[] parms = new ReportParameter[n];
parms[0] = new ReportParameter("param_name", textbox(n-1).text);
parms[1] = new ReportParameter("param_course", textbox(n).text);
this.reportViewer1.LocalReport.SetParameters(parms);
this.reportViewer1.RefreshReport();
 
Thank you For Ur support.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

ReportViewer1.ProcessingMode = ProcessingMode.Local;
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Sagotharan Jagadeeswaran at 10-Jun-11 1:24am
   
No friend. I try this, but The same error occurred again. In that question is also asked by me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 310
1 OriginalGriff 285
2 Afzaal Ahmad Zeeshan 200
3 Sergey Alexandrovich Kryukov 195
4 BillWoodruff 180
0 OriginalGriff 6,499
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,193
3 Manas Bhardwaj 4,657
4 Maciej Los 4,120


Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 17 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100