• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1856
  • Last Modified:

report.rdlc parameter

i designed report (report.rdlc) with parameter (PARAM1)
then from the form there is text box (txt.text="my name")
I want pass txt.text = "my name" to PARAM1
0
matalahmari
Asked:
matalahmari
1 Solution
 
kdwoodCommented:
Matal,

Here is what you need to do:

On the form load event of the form that you have embedded the ReportViewControl into, you add a parameter or parameters like this:

' Define a list of parameters to send to the report.   Note, there could be more than one parm in the list.

     Dim paramList As New Generic.List(Of ReportParameter)

     paramList.Add(New ReportParameter("myParmName", "myParmVal", True))

' Now assign the parameter list to the actual report via the SetParmameters method

     ReportViewer1.LocalReport.SetParameters(paramList)

' Refresh as display the report

    Me.ReportViewer1.RefreshReport()
    Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)


Now on the RDLC report itself you do the following:

1. Click on Report, then Report Parameters.  
2. Click add Parameter and give it a name in the name field.
3. Click Ok to close the dialog.
4. Right-Click On the textbox field on the report that you want to assign the parameter to and choose expression.
5. Click Parameter and then select the one that you just created above.  You will not see and expression that looks like =Parameters!YourParmName.

Click OK and run the report.

Regards,

Keith
0
 
matalahmariAuthor Commented:
DEAR kdwood:

I HAVE ERROR IN "ReportViewer1.LocalReport.SetParameters(paramList)"

EVERY THING IS OK BUT I DON'T KNOW WHY ERROR MESSAGE IS APPEARS SO PLEASE IF ANY ONE HAVE SAMPLE APPLICATION WITH VB.NET SEND IT TO ME
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now