在RDLC中执行自定义代码时出错 [英] Error while execute Custom Code in RDLC

查看:93
本文介绍了在RDLC中执行自定义代码时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用与vs 2008的rdlc报告。我已经尝试在rdlc报告模板的正文部分中生成单词。为此,我使用了自定义代码。[报告属性 - >代码..]。

但是在生成报告时我得到了#Error。请注释。

Hi,

I'm using rdlc report with vs 2008. I have been tried to generate amount in words in the body section of rdlc report template. For this, I used custom code.[Report Properties-> Code..].
But I got #Error while generating the report. Please comment.

推荐答案

错误在你的代码的第二行。

Error is in second line of your code.
Dim numb as string = Convert.toString(val)



只需删除此行即可正常工作。


just remove this line and it will work fine.


修复小数部分问题

fixed problem of decimal part
Public Function changeToWords(ByVal numb As [String]) As [String]
        Dim val As [String] = ""
        Dim wholeNo As [String] = numb
        Dim points As [String] = ""
        Dim andStr As [String] = ""
        Dim pointStr As [String] = ""
        Dim endStr As [String] = "Only"
        Dim decimalPlace As Integer = numb.IndexOf(".")
        If decimalPlace > 0 Then
            wholeNo = numb.Substring(0, decimalPlace)
            points = numb.Substring(decimalPlace + 1)
            If Convert.ToInt32(points) > 0 Then
                andStr = "and"
                'Change Start here in this block
                If (Len(points) > 1) Then
                    pointStr = translateWholeNumber(points).Trim()

                Else
                    pointStr = translateCents(points)
                End If
                'chnage end
                pointStr = pointStr & " Paise "
            End If
            End If
        val = [String].Format("{0} {1} {2} {3}", translateWholeNumber(wholeNo).Trim(), "Rupees " & andStr, pointStr, endStr)
            Return val
    End Function


这篇关于在RDLC中执行自定义代码时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆