VB.NET - VS 2010 RDLC Report with Subreport - passing value from parent report to subreport

Asked By tk on 04-Sep-12 05:01 PM
I am using Visual Studio 2010 to create a Windows Form Application in VB.NET. I have a report that contains a subreport. I am populating the parent report with a dataset built from a stored procedure in SQL. In the report viewer, I pass a variable to the dataset table adapter "Fill" function as the viewer loads. The subreport is using the same dataset as the main report, but I cannot figure out how to pass a variable from the main report to the sub report to pull in the right information.

Can someone please help me understand the steps involved in passing values from a parent report to a subreport? I cannot seem to get the parameter fields to work properly.

thanks.
Sreelakshmi replied to tk on 05-Sep-12 02:27 AM
Do follow these steps .This might help you to solve the issue.
1)Right click the sub report Control,Then select the sub report Name from the drop down list of Sub Report.
2).Go to parameter tab and Select the Parameter Name. NOTE: Parameter Name is just the Parameter you created for both of the reports,Parameter value.
3).Type in the expression =Parameters!Parameter.Value for parameter value, If the parameter is a multi-parameter,you should replace the expression =Parameters!Parameter.Value with =Parameters!Parameter.Label
U said ur using Dataset to load the data to the report.
If u use parameters then set the parameter value through Code.Is
ReportDocument rpt= new ReportDocument();
rpt.SetParameterValue(0,"Value");
here 0 indicates the parameter Number ie,the order of the parameters ie,1st or 2nd....! And Value is the value to be displayed on the report.

Do refer the Link for more info.
http://technet.microsoft.com/en-us/library/ms160348(SQL.105).aspx 
Do Please  refer this Link .mentioned in detail
https://skydrive.live.com/view.aspx/picture/Walkthrough-Displaying%20Sub%20report%20in%20Main%20report%20of%20local%20report%20using%20Report%20Viewer.docx?cid=45bfd76b0f2c3808&sc=photos 

I hope this will Help You................!