Passing Control Array to a SUB/FUNCTION 
Author Message
 Passing Control Array to a SUB/FUNCTION

Is it possible to pass a control array to a subroutine such as:

Call AlignCommandButton(cmdMyButtons())

Sub AlignCommandButton(cmdLocal() as commandbutton)

Do stuff

END SUB



Wed, 01 Oct 2003 20:29:04 GMT  
 Passing Control Array to a SUB/FUNCTION
Yes.  But instead of using the CommandButton object type, use the generic
Object data type.

    Private Sub AlignCommandButtons(oCommandButtons As Object)

        Dim oCommandButton As CommandButton

        For Each oCommandButton In oCommandButtons
            oCommandButton.Left = 300
        Next

    End Sub

    Private Sub Form_Click()

        AlignCommandButtons Command1()

    End Sub

Mike


Quote:
> Is it possible to pass a control array to a subroutine such as:

> Call AlignCommandButton(cmdMyButtons())

> Sub AlignCommandButton(cmdLocal() as commandbutton)

> Do stuff

> END SUB



Wed, 01 Oct 2003 23:50:14 GMT  
 Passing Control Array to a SUB/FUNCTION


Quote:
> Yes.  But instead of using the CommandButton object type, use the generic
> Object data type.

>     Private Sub AlignCommandButtons(oCommandButtons As Object)

>         Dim oCommandButton As CommandButton

>         For Each oCommandButton In oCommandButtons
>             oCommandButton.Left = 300
>         Next

>     End Sub

>     Private Sub Form_Click()

>         AlignCommandButtons Command1()

>     End Sub

> Mike



> > Is it possible to pass a control array to a subroutine such as:

> > Call AlignCommandButton(cmdMyButtons())

> > Sub AlignCommandButton(cmdLocal() as commandbutton)

> > Do stuff

> > END SUB

Thanks, just sus'd it

Nigel



Thu, 02 Oct 2003 00:39:14 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Pass control array to sub/function ?

2. pass an array as function/sub argument

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

4. Passing array back from Sub/Function

5. Passing arrays to SUBs and FUNCTIONs

6. Passing arrays from a server-function/sub to a server -variable

7. pass an array as function/sub argument

8. Passing Arrays to Sub / Functions

9. Passing arrays in a sub/function

10. Passing Control Arrays to Sub-Procedures

11. Passing control arrays to subs

12. Q: Passing first (original) element of a control array to a SUB

 

 
Powered by phpBB® Forum Software