
Using an array as an object property
Quote:
>The trick is that arrays are in fact passed as variants
?i?think?you?meant?to?say?that?to?pass?an?array?you?need?to?use?a?Variant?
BUT, THIS IS NO LONGER TRUE!!! In VB6 one can get away with:
Quote:
> Public Property Get BatchArray() As String()
> BatchArray = mvarBatchArray
> End Property
> Public Property Let BatchArray(vdata() As String)
> mvarBatchArray = vdata
> End Property
WILL PEOPLE PLEASE POST VB VERSION NUMBER WITH THEIR QUESTIONS !
Neila
Quote:
>Marty,
>The trick is that arrays are in fact passed as variants. The following
>should work (it does for me):
>Private mvarBatchArray
>Public Property Get BatchArray() As Variant
> BatchArray = mvarBatchArray
>End Property
>Public Property Let BatchArray(vdata As Variant)
> mvarBatchArray = vdata
>End Property
>You can drop the "As Variant" in both, but it is better to include them as
>a reminder to yourself and others.
>John...........
>> I wanted to use a dynamic array as a property for a user control
>> object. But when I do what seems logical to me --actually even it
>> doesn't quite make sense, but I'm not sure what to do, I get an error
>> message that says that the definitions are inconsistent
>> Here's what I tried
>> Public Property Get BatchArray() As String
>> BatchArray = mvarBatchArray
>> End Property
>> Public Property Let BatchArray(vdata() As String)
>> mvarBatchArray = vdata
>> End Property
>> I'm not sure how to tell the Get that this is an array, so that the Let
>> can use it as one as well. What am I missing?
>> Thanks,
>> Marty