Crystal Reports:通过 VB.NET 以编程方式设置子报表中的参数值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18251212/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 14:41:09  来源:igfitidea点击:

Crystal Reports: Programmatically setting parameter values in a subreport through VB.NET

vb.netcrystal-reportsparameter-passingsubreport

提问by SpinaloS

When trying to print my Crystal Reports RPT(MainReport) in my CrystalReportViewer1, I don't know how to set the parameter for the Subreport (report1).

尝试在我的 CrystalReportViewer1 中打印我的 Crystal Reports RPT(MainReport) 时,我不知道如何设置子报表 (report1) 的参数。

I've tried this:

我试过这个:

Report1.DataDefinition.ParameterFields("@code_machine").CurrentValues.AddValue(3)

But it doesn't work, it show me the input box of CrystalReports.

但它不起作用,它显示了CrystalReports的输入框。

I also tried :

我也试过:

Report1.SetParameterValues("@code_machine", 3)

What am I doing wrong?

我究竟做错了什么?

回答by user2752614

MainReport.SetParameterValue("@code_machine", 3, "report1")

MainReport.SetParameterValue("@code_machine", 3, "report1")

Documentation reference: https://web.archive.org/web/20140321115705/http://msdn.microsoft.com/en-us/library/ms226106(v=vs.80).aspx

文档参考:https: //web.archive.org/web/20140321115705/http: //msdn.microsoft.com/en-us/library/ms226106(v=vs.80).aspx