Results 1 to 5 of 5

Thread: Private Communication between classes

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Liverpool, England
    Posts
    88

    Unhappy Private Communication between classes

    Hi all,

    I have two classes in my ActiveX DLL component. I wish to use properties from one class inside the other.

    How do I do this? I'm I on the write lines with using Friend Properties.

    Thanks, Paul

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    If you only want the classes that are in the DLL to use the properties, then yes, use Friend.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Liverpool, England
    Posts
    88

    Example?

    Hi, thanks for that. I can understand the theory behind using the Friend Properties, but having difficulty in putting it into practice!

    EG

    Class 1

    Friend Property Get CustomerName() as string
    CustomerName = mstrCustomerName
    End Property

    Private Property Let CustomerName(vData as string)
    mstrCustomerName = vData
    End Property

    Class 2

    I want to access this Property so whats the code???

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Right now, only Class1 has Let access to your property. Use Friend on both the Let and the Get, and then in Class2, its just a matter of...
    VB Code:
    1. Dim mCls1 As New Class1
    2.  
    3. mCls1.CustomerName = "Joe"

    Just like any other property.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Liverpool, England
    Posts
    88

    OK

    OK I understand that. But if you Dim the class as new I will lose the contents of the Property.

    I want Class 1 to Let and Get, but only Get the property from Class 2.

    Thanks, Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width