RDLC 微软报表 自定义函数

报表的空白处点右键,报表属性,CODE,按下面的格式输入自定义函数:
  1. Shared Function ShowDate(value as DateTime) as string
  2. if value<=DateValue("1900-1-1") then
  3. return ""
  4. else
  5. return FormatDateTime(value,DateFormat.ShortDate)
  6. end if
  7. End Function


调用: 表达式中输入
  1. =code.ShowNumber(Fields!PurchCC.Value,3)


格式化数字:
  1. Shared Function ShowNumber(value as Double, digit as integer ) as string
  2. if value=0 then
  3. return ""
  4. else
  5. return FormatNumber(value, digit)
  6. end if
  7. End Function






原文地址:https://www.cnblogs.com/ybst/p/5072386.html