How to concatenate values in RDLC expression?

前端 未结 2 1518
天涯浪人
天涯浪人 2021-01-04 00:58

I have an RDLC file in which I want to make an expression. Here is the image of properties of expression. I need to concatenate First Name, Last name and Middle Init.

<
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 01:50

    Check this : http://blogs.msdn.com/b/mosharaf/archive/2005/12/20/localreportcustomcode.aspx

    it is possible to do in a different way in the rdlc report you can use VB code. Just click on the report with right mouse button. When the context menu from where you enter parameters go to Proprties. When clicking it you should see a tab control witch few tab pages. Go to tab page "Code" an there right you VB function it must be something like this

         Public Function concatestring(ByVal val1 As Object,ByVal val2 As Object,ByVal val3 As Object ) As String
    //         return val1 + ' ' + val2 + ' ' + val3 -- just string cocate in vb will do your task
            End Function
    

    Then call the function in your textbox like this

    = Code.concatestring(Fields!MyField_1.Value,Fields!MyField_2.Value,Fields!MyField_3.Value )
    

    P.S. I am not very sure if the VB code is working correctly just test it and if it is needed rewrite. If any other error occurs please post it to see what is the problem

提交回复
热议问题