array object property possible? 
Author Message
 array object property possible?

Is is possibly when creating a new class to define properties for that
class as arrays?  Using the Class Builder I was only able to pick a data
type but not specify that I wanted an array of items.  I would like to
be able to reference the object as such:

dim myobj as new myclass

myobj.array1(x) = 10

Please let me know. I appreciate it.

Sincerely,

Derek Smith
INJOY, Inc



Sun, 04 Jun 2000 03:00:00 GMT  
 array object property possible?

Quote:

> Is is possibly when creating a new class to define properties for that
> class as arrays?  Using the Class Builder I was only able to pick a data
> type but not specify that I wanted an array of items.  I would like to
> be able to reference the object as such:

> dim myobj as new myclass

> myobj.array1(x) = 10

> Please let me know. I appreciate it.

> Sincerely,

> Derek Smith
> INJOY, Inc


below is an example of what u want to do..they will allow you to
retrieve an entire array or just and item.
the reason for the default value of -1 is if the user wants the 0th
element

private m_arr as variant

Property Let Value(Optional i As Integer = -1, lvVal As Variant)
    If i = -1 Then
        m_arr = lvVal
    Else: m_arr(i) = lvVal
    End If
end Property

Property Get Value(Optional i As Integer = -1) As Variant
    If i = -1 Then
        Value = m_arr
    Else: Value = m_Value(i)
    End If
End Property

you can then call as follows..

arr=myObj.Value
lsVal=myObj.value(i)
myObj.Value=arr
myObj.Value(i)=lsVal

hope this helps



Sun, 04 Jun 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Object Properties, Array Properties

2. Array of Form Objects - Possible???

3. Possible to Store Objects in Arrays?

4. Possible bug in properties which set/return objects?

5. Array as a Property of an Object, and Collection

6. Using an array as an object property

7. Property Array in an Object ?

8. Objects with arrays as public properties

9. Help: VB3: Arrays of arrays possible?

10. REQ : How to create an activex (VB5) with property like mycontrol.array(x).properties

11. Object array to string array

12. Problem with Property-Object Type-Property

 

 
Powered by phpBB® Forum Software