Passing Property Arrays to Sub Routines 
Author Message
 Passing Property Arrays to Sub Routines

Is it even possible to pass property arrays to sub routines. I tried it
and it said "Aurgument not optional" as if it wanted a specific element.

To Clarify:

Call MySub(MyObject.MyPropertyArray())

Error: Aurgument not optional



Thu, 31 Jan 2002 03:00:00 GMT  
 Passing Property Arrays to Sub Routines
MaxBenson ,
OK??? ,  what is the signature for MySub? Help us help you!
How is MyPropertyArray set up? What do you mean precisely by
a Property Array?.
Neila
Quote:

>Is it even possible to pass property arrays to sub routines. I tried it
>and it said "Aurgument not optional" as if it wanted a specific element.

>To Clarify:

>Call MySub(MyObject.MyPropertyArray())

>Error: Aurgument not optional



Thu, 31 Jan 2002 03:00:00 GMT  
 Passing Property Arrays to Sub Routines
"Property array" was a little daring. I am  new to OOP. What I meant was
Property procuderes that act like arrays. Like this

Public Property Get Ext(iIndex As Integer) As String
    Ext = mstrExt(iIndex)
End Property

Public Property Let Ext(iIndex As Integer, sData As String)
   mstrExt(iIndex) = sData
End Property

The Index aurgumet acts like the Index of an array index. Then in the form I
call the sub like this
Call MySub(ByRef Ext())

MySub simply would fill Ext() with data. I hope this is easier to understand.

Quote:

> MaxBenson ,
> OK??? ,  what is the signature for MySub? Help us help you!
> How is MyPropertyArray set up? What do you mean precisely by
> a Property Array?.
> Neila


> >Is it even possible to pass property arrays to sub routines. I tried it
> >and it said "Aurgument not optional" as if it wanted a specific element.

> >To Clarify:

> >Call MySub(MyObject.MyPropertyArray())

> >Error: Aurgument not optional



Thu, 31 Jan 2002 03:00:00 GMT  
 Passing Property Arrays to Sub Routines
I am not absolutely sure what you are up to. However it looks like you might
get some mileage with a Collection object?
Neila

Quote:

>"Property array" was a little daring. I am  new to OOP. What I meant was
>Property procuderes that act like arrays. Like this

>Public Property Get Ext(iIndex As Integer) As String
>    Ext = mstrExt(iIndex)
>End Property

>Public Property Let Ext(iIndex As Integer, sData As String)
>   mstrExt(iIndex) = sData
>End Property

>The Index aurgumet acts like the Index of an array index. Then in the form
I
>call the sub like this
>Call MySub(ByRef Ext())

>MySub simply would fill Ext() with data. I hope this is easier to
understand.


>> MaxBenson ,
>> OK??? ,  what is the signature for MySub? Help us help you!
>> How is MyPropertyArray set up? What do you mean precisely by
>> a Property Array?.
>> Neila


>> >Is it even possible to pass property arrays to sub routines. I tried it
>> >and it said "Aurgument not optional" as if it wanted a specific element.

>> >To Clarify:

>> >Call MySub(MyObject.MyPropertyArray())

>> >Error: Aurgument not optional



Thu, 31 Jan 2002 03:00:00 GMT  
 Passing Property Arrays to Sub Routines

Quote:
>I am not absolutely sure what you are up to. However it looks like you might
>get some mileage with a Collection object?

Seems the same to me...  Check the following articles in VB Help (may only be
with the MSDN CD) or on the MSDN Website:

"House of Straw"
"House of Sticks"
"House of Bricks"

It's a three-part series that shows progressively safer ways to implement a
"Property Array" using collections and collection classes.  It ends up being a
very elegant way to create an object model (most MS technologies, such as DAO
and ADO seem to use this sort of structure).

-Curtis Spendlove
-Solstice Software



Fri, 01 Feb 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Newbie question about passing arrays into a sub routine

2. Passing a text box name to a sub routine

3. Multi-Dimension Arrays - how to pass to routines?

4. pass an array as function/sub argument

5. Question on passing array parameters to VB.NET Sub/Function

6. Problem in passing datarow array from one sub to other

7. Passing Arrays from Sub to Program

8. Help! Problem passing string array to sub

9. vb5 Passing an array of type MENU to a Sub

10. How to pass array into Sub?

11. Passing Control Arrays to Sub-Procedures

12. Passing array back from Sub/Function

 

 
Powered by phpBB® Forum Software