embedded classes or methods?

liquid8

Active member
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:

Code:
Class Pages
     Class Buttons
          Property Add()
          End Property
     End Buttons
End Class

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

Thanks in advance,
liquid8
 
Thats 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 youd make a readonly property in the Pages class called Buttons, of type ButtonCollection.

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

Code:
Pages.Buttons.Add(blah)

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

If you wanted Pages itself to be a collection, youd 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.. ill look more into the collectionbase.. thanks for steering me in the right direction.

LiQuiD8
 
Back
Top