2

I am having a class which has Collection as a property,

Bond Class

Private pBondiSIN As String
Private pBroker As Collection

''''''''''''''''''''''
' BondiSIN property
''''''''''''''''''''''
Public Property Get BondiSIN() As String
    BondiSIN = pBondiSIN
End Property
Public Property Let BondiSIN(Value As String)
    pBondiSIN = Value
End Property

''''''''''''''''''''''
' Broker property
''''''''''''''''''''''
Public Property Get Broker() As Collection
    Broker = pBroker
End Property
Public Property Let Broker(Value As Collection)
    pBroker = Value
End Property

And I call it this way:

Set tempBond = New Bond
tempBond.Broker = New Collection  => Gives me a error as Wrong number of Arguments or Invalid property assignment

Not sure how to solve this error. Need some help on this.

lakshmen
  • 28,346
  • 66
  • 178
  • 276

1 Answers1

5

Get familiar with the Set keyword

Public Property Set Broker(Value As Collection)
    Set pBroker = Value
End Property

and

Set tempBond.Broker = New Collection
Community
  • 1
  • 1