Results 1 to 2 of 2

Thread: The property Let (heeeelllpp)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Guadalajara, Jalisco, Mex
    Posts
    105

    Angry

    Hi,

    I have a class named clsXArray, that have a property like this:

    Private intArray(40) as integer

    and its properties Let and Get (like this)

    Public Property Get MyArray(Pos as Integer) as Integer
    MyArray = intArray(Pos)
    end property

    Public Property Let MyArray(Pos as Integer,intValue as Integer)
    intArray(Pos) = intValue
    end property

    ok

    Well, this class it's a property of another class.
    Remember, the property "MyArray" its the default property.



    dim MyObject as AnotherClass
    (thearray as clsXArray)
    Ok, when i do this
    x = MyObject.thearray(5)

    works, but if i do this
    MyObject.thearray(5) = 5

    vb falls in an compiling error,
    but, if i make this way

    MyObject.thearray.myarray(5) = 5

    NO PROBLEM. WHYYYYYYYY ????????
    (i already initialize the property "thearray" with new)

    Thanks








  2. #2
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Property mismatch

    When you call tharray which I am assuming is in a class file. You are wanting to access a property. And if you don't call the property, VB will call error. When accessing thearray, you have to call the myarray property. Is thearray section really needed. As I said, I'm not too sure, but could you just call MyObject.MyArrar(5) = 5 ??

    Best of luck
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

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