Click here to Skip to main content
15,898,897 members
Please Sign up or sign in to vote.
4.80/5 (2 votes)
See more:
Hi All,

I am using winform, c#, mysql in my project.

In that i create a rdlc report. I dont know to pass winform textbox value to rdlc report text field.

I googled and try some set of code. but cant get that.

If you worked in report. please help me.

My requirement is,..

I am doing college project. In that they asked bonafide certificate. So i create a winform With reportviwer, name, course, year, semester, academic year textboxs and one button. Click the button when the textboxes are filled. those text values want to pass the record textboxes.

Is it possible any way.

Thanks in Advance.
Posted
Updated 9-Jun-11 20:12pm
v2

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.

Step by step process...

1) Create parameter in RDLC Report.
2) Place the parameter Where you want in the RDLC Input Textbox property.
3) Type the below code in Reprot.cs page.
4) Passing the parameter value where you redirect the Report page.

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 your support.
 
Share this answer
 
v2
Comments
cgdavidprince 16-Jun-11 7:36am    
same thing i want to do, But your explanation is not understandable for my knowledge. Could send it again clearly? Clearly in the sense, step by step process. It's very urgent. davidprincecg@gmail.com
SelfCom 1-May-14 8:45am    
I am not getting clearly. Please explain . . . .

I have a table "TestReport" with as below fields :

TestNo - integer
PatientName - String
Add - String
..
..
..
..


i want to show specific TestNo report.

i have write : " select * from TestReport " in DataSet TableAdapter.

Made RDLC report on this tableadapter. It shows all records.

I want to show record of TestNo = 2

How can I set report parameter with TestNo field ?
Rò77 25-Feb-17 7:37am    
Hi..can you please help me..
Rò77 25-Feb-17 7:42am    
Where to write this code under which sub??
In parameter what should select under available and default values..??
When I execute "para x is missing" error us showing...
From morning I'm trying not nly today but many days..😕
Can u...
Help me....😞
 
Share this answer
 
Comments
Sagotharan Jagadeeswaran 10-Jun-11 2:42am    
I tried that, but exception occured. see my post, http://www.codeproject.com/Questions/208964/How-to-Fix-the-bug-Local-processing-Exception-was.

Can you help to fix this bug?.
I'm still facing that problem.
can you convert the code in vb.net2010? pls? tnx
 
Share this answer
 
Comments
Sagotharan Jagadeeswaran 7-Sep-12 6:48am    
sorry ma,. I know C# only.
VB
Dim parms As ReportParameter() = New ReportParameter(n - 1) {}
parms(0) = New ReportParameter("param_name", textbox(n - 1).text)
parms(1) = New ReportParameter("param_course", textbox(n).text)
Me.reportViewer1.LocalReport.SetParameters(parms)
Me.reportViewer1.RefreshReport()

Next time go to google and search "code converter". Though code converters are not always perfect but they do the job.
 
Share this answer
 
Comments
Rò77 25-Feb-17 7:21am    
Can you please help me..
I've been trying this for many days
But I didn't get a solution
Where should I write this code in the report viewer code window? Under form_load???
And which textbox have you mentioned
From morning I'm so tired of trying
Can u help me...
musacj 5-Apr-17 15:08pm    
This has been a long time.
Should be on the button the user is clicking, I think (Remember, it was 2012 when I wrote this and I don't work with reports any more)
Look at "solution 1" above
hai bro..
you may simply store that values in Table .and take those values from table and fetch to form.

each time take the first value by using top or where clause.. k..


i think ur requirement is meets with my solution...
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900