VB.net report rdlc parameter

Is there a way to display a report parameter inside of a rdlc report?
LVL 2
jimseiwertAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jimseiwertAuthor Commented:
well let me add more detail. what i am doing is reading a xml file into a datatable. I need to display those fields into the report but I cant seem to get it to work. In the textbox field under dataelementname i provided the column name but when the report displays it is blank. I have confirmed that the datatable has rows with data in them.
0
Jorge PaulinoIT Pro/DeveloperCommented:
What have you done so far ?
Have you already defined the parameter in the report and pass it using LocalReport.SetParameters() method ?
0
jimseiwertAuthor Commented:
Yes, i just need to display it in the actual report itself
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Jorge PaulinoIT Pro/DeveloperCommented:
Ok, then you have the report, the form with the reportviewer and that report defined for the reportviewer. What code are you using to assign the parameters and how are you showing in the report ?
0
jimseiwertAuthor Commented:
right now I have a textbox field on the report. I want to show the passed parameter (orderNumer) on the textbox
0
Jorge PaulinoIT Pro/DeveloperCommented:
Then you define the parameters and select the textbox. Right click and choose "Expression" and in the expression box you will find a Parameter category where you can choose the parameter you want.
Finally you just have to use this code:

Dim parameters(0) As ReportParameter
parameters(0) = New ReportParameter("ParameterName", "Value to be showed in the report")
frm.ReportViewer1.LocalReport.SetParameters(parameters)

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jimseiwertAuthor Commented:
I did the above steps with the below code. (I replaced and tried your sample)
    Dim report As LocalReport = New LocalReport()
        report.ReportPath = Application.StartupPath & "\Labels\Report2.rdlc"
        Dim parameters(3) As ReportParameter
        parameters(0) = New ReportParameter("Warehouse", "Jim")
        parameters(1) = New ReportParameter("CDate", "Jim")
        parameters(2) = New ReportParameter("OrderNum", "Jim")
        parameters(3) = New ReportParameter("Trans", "Jim")
        report.SetParameters(parameters)

Open in new window

0
jimseiwertAuthor Commented:
Sorry I did not finish what I was typing, when the report prints all it shows is "Parameters!CDate.Value" w/o the quotes
Dim report As LocalReport = New LocalReport()
report.ReportPath = Application.StartupPath & "\Labels\Report2.rdlc"
Dim parameters(3) As ReportParameter
parameters(0) = New ReportParameter("Warehouse", "Jim")
parameters(1) = New ReportParameter("CDate", "Jim")
parameters(2) = New ReportParameter("OrderNum", "Jim")
parameters(3) = New ReportParameter("Trans", "Jim")
report.SetParameters(parameters)
Export(report)
m_currentPageIndex = 0
Print()

Open in new window

0
Jorge PaulinoIT Pro/DeveloperCommented:
You're trying to print/export the report and does that shows ok for the other things ?
 
0
jimseiwertAuthor Commented:
All I have is some textboxes that have statis text and that parameters. The static text shows fine.
0
jimseiwertAuthor Commented:
O have tried to open the report in the reportviewer without printing or exporting and it still displays the same with showing "Parameters!Trans.value

It almost seems as if it is thinking it is a string vs a parameter
0
jimseiwertAuthor Commented:
I got it, in the expression when I selected the parameter as the value it did not add a equal sign in front of it. Once I added that it worked. Thanks for your help
0
jimseiwertAuthor Commented:
Note to all others. In the expression don't forget the "=" in front of the parameter
0
Jorge PaulinoIT Pro/DeveloperCommented:
Glad I could help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

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.