Hallo i have a BindingList of Work and i want to make one of the object instance is a total of all other object instances.
for example i have property "ID" , ID from 1 - 99 are reserved for calculating cost and instance with ID 100 is a sum of all. I would like to know how it is normally done or is there any alternative?
Public Class Work
Public Property ID As Integer
Public Property Description As String
Public Property Quantity As Integer
Public Property UnitCost As Integer
Public ReadOnly Property Cost As Integer
Get
Return GetCost()
End Get
End Property
Public Function GetCost() As Integer
Dim CalCost As Integer
Select Case ID
Case 1 To 99
CalCost = UnitCost * Quantity
Case 100 ''100 is the ID for Total
CalCost = Sum() Of Cost "totalcost"??? SUM of all Object In this collection
End Select
Return CalCost
End Function
End Class
Thanks
