向RDLC自定义代码添加多个功能 [英] Adding multiple functions to RDLC custom code
问题描述
我正在尝试为我的 Web 应用程序制作一个相对复杂的 rdlc 报告,而我目前面临的问题是报告的自定义代码部分中定义了一个函数.然后我在那里添加了另一个函数,报告没有执行,给出错误报告的定义无效".每次我删除此功能时,报告都会顺利运行,当我将其添加回来时,它会在报告查看器中出现此错误.
I am trying to make a comparatively complex rdlc report for my web application and the problem that I am currently facing is that there is one function defined in the custom code section of the report. And then I added another function there and the report is not executing giving an error "The definition of report is invalid." Everytime I remove this function the report runs smoothly, when I add it back it gives this error in the report viewer.
推荐答案
用于在 rdlc 中编写自定义代码:
For writing custom code in rdlc :
- 在报告"菜单上,单击报告属性".
- 在引用"选项卡上,单击添加"按钮,然后从添加引用"对话框中选择或浏览到程序集.
- 在类中,键入类的名称并提供要在报告中使用的实例名称.这是实例成员的情况,对于静态(在 VB 中共享)成员的情况,您不需要在类中添加任何内容.
在自定义代码中,您可以编写函数:
In Custom Code You can Write your functions:
Public ReadOnly Property FetchSomeData() As String
Get
Return sharedMember
End Get
End Property
Dim sharedMember As String = "Shared Data (Does not require initialization)"
Public Function MyFunction(ByVal s As String)
'' Write your code and return String
Return s.toUpper()
End Function
这篇关于向RDLC自定义代码添加多个功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!