
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