A
alanb
I have one object which holds a collection of other objects. I'll make
one up as my specific example is too abstract and too much code:
Public Class Job
Dim CandidateCollection As New Collection
Public Sub AddCandidate(ByVal aCandidate As Candidate)
CandidateCollection .Add(aCandidate)
End Sub
Public Sub AProcedure()
' code here
End Sub
End Class
Public Class Candidate
Public Property Name() As String
Get
Return mName
End Get
Set(ByVal Value As String)
mName = Value
' now trigger Job AProcedure
End Set
End Property
End Class
What I'm trying to do is trigger an event in the Set Property Name to
run the sub in the class Job, i.e. when I run code:
Job.Candidate(1).Name = "Smith"
the sub AProcedure in Job runs. I suspect the answer may be a
reconstruction of the classes and/or collection, or is this legitimate
code with an easy way to call the sub?
TIA,
Alan
one up as my specific example is too abstract and too much code:
Public Class Job
Dim CandidateCollection As New Collection
Public Sub AddCandidate(ByVal aCandidate As Candidate)
CandidateCollection .Add(aCandidate)
End Sub
Public Sub AProcedure()
' code here
End Sub
End Class
Public Class Candidate
Public Property Name() As String
Get
Return mName
End Get
Set(ByVal Value As String)
mName = Value
' now trigger Job AProcedure
End Set
End Property
End Class
What I'm trying to do is trigger an event in the Set Property Name to
run the sub in the class Job, i.e. when I run code:
Job.Candidate(1).Name = "Smith"
the sub AProcedure in Job runs. I suspect the answer may be a
reconstruction of the classes and/or collection, or is this legitimate
code with an easy way to call the sub?
TIA,
Alan