CollectionBase - how to expose?

  • Thread starter Thread starter Ian Ashworth
  • Start date Start date
I

Ian Ashworth

Id like to be able to set a new instance of the EposTransaction class and
add Sale items to the Sales collection via
EposTransaction.Sales.Add(SaleItem). Basically want all the functionality
of the Sales collection class exposed within my Transaction class.

I'm new to .net from a classic vb background so any help would be greatly
appreciated.

' ******* Begin code *********
Public Class EPoSTransaction
Dim minsSales As New Sales
Public ReadOnly Property Sales()
Get
Return CType(_Sales, Sales)
End Get
End Property
End Class

Public Class Sales
Inherits System.Collection.CollectionBase

Public Sub Add(ByVal vinsSale As Sale)
List.Add(vinsSale)
End Sub

Public Sub Remove(ByVal Index As Integer)
If Index < 0 Or Index > Count - 1 Then
'Invalid Index
Else
List.RemoveAt(Index)
End If
End Sub

Default Public ReadOnly Property Item(ByVal Index As Integer)
Get
Return Ctype(List.Item(Index), Sale)
End Get
End Property
End Class

Public Class Sale
Private _SaleValue As Single

Public Property SaleValue()
Get
Return _SaleValue
End Get
Set(ByVal Value)
_SaleValue = Value
End Set
End Property
End Class

' ****** End Code *********

Thanks in advance

Ian Ashworth
 
Don't worry guys I got it, Sales/Payments need to be functions not
properties.

Thanks
Ian
 
Back
Top