P
Pete Mitchell
I have three classes named: Action, Link, LinkCollection.
Action class represents a row in table called Actions.
Link class represents a row in table called Links.
The Action table is the parent and the Links table is the child.
The LinkCollection class contains a HashTable collection of Link classes.
In my Action class I have a Public member variable called colLinks and a
method to populate it when I populate the Action class:
Public Class Action
Public colLinks = New LinkCollection()
...
Public Function LoadClass
....
GetChildren
End Function
Private Function GetChildren() as Boolean
'Do stuff to populate colLinks LinkCollection class with Link
classes
End Function
End Class
Called from my client application this all works so far:
Dim objAction As Actions
Dim objLink As New Links
objAction = New Actions
objAction.Action_ID = 1
objAction.LoadClass()
The Parent class is populated and its public member colLinks is loaded full
of Link classes.
The problem I'm having is looping through the colLinks collection:
I can't do this:
For Each objLink In objAction.colLinks()
..........Party with each Link class individually
Next
This causes an exception "System.MissingMemberException","No Default member
found for type LinkCollection" on the For Each line.
But I can declare a local object and set it equal to the Action class's
public member:
Dim colPete As LinkCollection
colPete = objAction.colLinks
For Each objLink In objAction.colLinks()
..........Party with each Link class individually
Next
No errors doing this.
What is going on ?? Any thoughts ???
Thanks in Advance.
Pete
Action class represents a row in table called Actions.
Link class represents a row in table called Links.
The Action table is the parent and the Links table is the child.
The LinkCollection class contains a HashTable collection of Link classes.
In my Action class I have a Public member variable called colLinks and a
method to populate it when I populate the Action class:
Public Class Action
Public colLinks = New LinkCollection()
...
Public Function LoadClass
....
GetChildren
End Function
Private Function GetChildren() as Boolean
'Do stuff to populate colLinks LinkCollection class with Link
classes
End Function
End Class
Called from my client application this all works so far:
Dim objAction As Actions
Dim objLink As New Links
objAction = New Actions
objAction.Action_ID = 1
objAction.LoadClass()
The Parent class is populated and its public member colLinks is loaded full
of Link classes.
The problem I'm having is looping through the colLinks collection:
I can't do this:
For Each objLink In objAction.colLinks()
..........Party with each Link class individually
Next
This causes an exception "System.MissingMemberException","No Default member
found for type LinkCollection" on the For Each line.
But I can declare a local object and set it equal to the Action class's
public member:
Dim colPete As LinkCollection
colPete = objAction.colLinks
For Each objLink In objAction.colLinks()
..........Party with each Link class individually
Next
No errors doing this.
What is going on ?? Any thoughts ???
Thanks in Advance.
Pete