CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 1999
    Location
    Trivandrum, Kerala, INDIA.
    Posts
    32

    Adding User Classes to Collection Control

    I am not able to add user classes to a Collection.

    In Class module Class1, put



    option Explicit
    Dim m_a as Byte

    public property get A() as Byte

    m_a = A

    End property

    public property let A(byval vNewValue as Byte)

    m_a = vNewValue

    End property





    And in the form module Form1, put



    ption Explicit


    private Sub Form_Load()

    Dim col as new Collection

    Dim byte1 as new Class1, byte2 as new Class1

    byte1.A = 12
    byte2.A = 25

    col.Add byte1
    col.Add byte2


    End Sub






    When I debug, the contents of the items in the class are 0. What's up?

    Deepak


  2. #2
    Join Date
    Sep 1999
    Posts
    202

    Re: Adding User Classes to Collection Control

    public property get A() as Byte
    ' m_a = A ' replace this line
    A = m_a
    End property




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

Featured