Search code examples
vb.netrdlcdynamic-rdlc-generation

My SUM Function - rdlc - custom code -total


I would like to pass a value and add to it with the previous value thats what I want.. The below code doesn't work...I can't understand the problem.. Actually its for rdlc - total purpose I need it. My Code

public MyValue as Decimal=0
public Function AddToSum(ByVal quantity as Decimal) as Decimal
MyValue=AddToSum+quantity
AddToSum=MyValue
return AddToSum
End Function 

Suppose I have a Table field bill_amt 

bill_amt   AddToSum(bill_Amt) should be like the below
15             15
25             40
35             75

Is it possible?


Solution

  • Not sure what you tried to do with your sample code, but you can simply do this:

    Public MyValue as Decimal = 0
    Public Function AddToSum(ByVal quantity as Decimal) as Decimal
      MyValue = quantity + MyValue
      Return MyValue
    End Function