embedded classes or methods?

liquid8

Freshman
Joined
Jan 14, 2003
Messages
31
I have been trying to find out how exactly you can embed classes/methods to get the following line to be processed:

Pages(1).Buttons(1).Add

How would a basic class look for this? Or would you have to create a Namespace?

I was trying to do something like:

Visual Basic:
Class Pages
     Class Buttons
          Property Add()
          End Property
     End Buttons
End Class

But I don't see a way or can't pass an index to a Class, can I? Basically, I want properties within properties or methods within methods..

Thanks in advance,
liquid8
 
That's not "embedding" classes or methods. In this case, you would define your Pages class, and you would define a strongly-typed collection called ButtonCollection or something. Then you'd make a readonly property in the Pages class called Buttons, of type ButtonCollection.

Assuming the ButtonCollection had an Add method, you could then do,

Visual Basic:
Pages.Buttons.Add(blah)

For more help on creating a strongly-typed collection, see the CollectionBase class in the help. You'll have to inherit this.

If you wanted Pages itself to be a collection, you'd have to have to go two levels higher and write a PageCollection class, and have another class to host a property called Pages, of that type.
 
looks a bit more difficult than i thought.. i'll look more into the collectionbase.. thanks for steering me in the right direction.

LiQuiD8
 
Back
Top