vb.net 将文本框数据传递给 RDLC 报告
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17631288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pass TextBox Data to RDLC report
提问by Justin Leroux
My apologies for such a simple question but after 3 days of searching I cannot find an answer. I have a VS 2012 VB.NET application and Report. I would like to have the user enter information on a windows form, for example "Client Name: [textbox1] ". I want to pass the entered value of textbox1 to a report field. I have created the report field textbox and created a parameter in the report (rdlc) as @reportparam1. Once the user completes the form he/she will press a button that brings up the report.
对于这么简单的问题,我深表歉意,但经过 3 天的搜索,我找不到答案。我有一个 VS 2012 VB.NET 应用程序和报告。我想让用户在 Windows 窗体上输入信息,例如“客户端名称:[textbox1]”。我想将 textbox1 的输入值传递给报告字段。我创建了报告字段文本框,并在报告 (rdlc) 中创建了一个参数作为 @reportparam1。用户完成表单后,他/她将按下一个按钮以显示报告。
回答by tezzo
You have to set parameter value and pass it to your report:
您必须设置参数值并将其传递给您的报告:
Dim parReportParam1 As New ReportParameter("parReportParam1", Me.TextBox1.Text)
Me.YourReportViewer.LocalReport.SetParameters(New ReportParameter() {parReportParam1})
In your report you must set textbox value as:
在您的报告中,您必须将文本框值设置为:
=Parameters!parReportParam1.Value

