如何将变量传递给ReportViewer中的表达式 [英] How to Pass a Variable to an Expression in the ReportViewer
问题描述
大家好,
我不确定这是否可行,但是我想为本地的一个表的Visibility选项卡设置一个表达式RDLC报告检查变量的值。基本上,我有一个布尔变量, PrintSysInfo ,在我的解决方案的公共模块中设置:
I'm not sure if this is possible, but I want to set an expression for the Visibility tab of a table that I have in a local RDLC report to check the value of a variable. Basically, I have a boolean variable, PrintSysInfo that is set in the Public Module of my solution:
公共 PrintSysInfo As Boolean = False
Public PrintSysInfo As Boolean = False
我以另一种形式引用它,它可以设置为True或False。当我的报告运行时,我希望只有当 PrintSysInfo 为True时才显示此特定表。
I refer to it in another form where it can be set to True or False. When my report runs, I want to have this particular table show up only if PrintSysInfo is True.
我希望能够进入"可见性"选项卡在表中,将其设置为Expression,然后输入如下内容:
I was hoping to be able to go into the Visibility tab of the table, set it to Expression and then put in something like:
= iif(PrintSysInfo =真,假,真)
=iif(PrintSysInfo = True, False, True)
但如果我把它放在那里然后尝试运行我的代码,我会收到以下错误:
But if I put this in there and then try to run my code, I get the following error:
表'table1'的隐藏表达式包含错误:[BC30451]名称'PrintSysInfo'未声明。
有没有一种简单的方法可以解决这个问题或其他解决方案?
Is there an easy way to fix this or another solution to my problem?
感谢您的帮助!! !
- 吉姆
推荐答案
我认为您需要添加对程序集的引用(http://msdn2.microsoft.com/en-us/library/ms155974.aspx ) - 否则您无法访问该属性从报告中。
I think you need to add a reference to your assembly (http://msdn2.microsoft.com/en-us/library/ms155974.aspx) - otherwise you cannot access that property from within the report.
有关在报告中使用嵌入式代码和自定义程序集的一般信息:http://msdn2.microsoft.com/en-us/library/ms155798.aspx
General information about using embedded code and custom assemblies in reports: http://msdn2.microsoft.com/en-us/library/ms155798.aspx
- 罗伯特
这篇关于如何将变量传递给ReportViewer中的表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!