Having a sub in one class read information from another class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • erik eriksson
    New Member
    • Oct 2010
    • 1

    #1

    Having a sub in one class read information from another class

    I am having problems accessing the attributes/functions of a class inside other classes.

    I will try to explain my structure as easy as possible and I have simplified it to focus on what is giving me all the problems:

    Class A contains a collection (ACol) which consists of objects of the B class

    Class B has a public attribute of type string called Name

    Class C contains a sub

    I would like the sub inside class c to be able to read all the different names in ACol.

    I tried:

    dim c as B
    For each c in A.Acol
    c.name…… something something


    It seems the sub in class C cannot access the information in the other classes. If I put the same code in my “main” file and not another class it works.

    In short my question is how you can access information stored in a one class from another class.
Working...