Passing an Array of Controls to a Sub 
Author Message
 Passing an Array of Controls to a Sub

How can I pass an array of controls (for instance, array of Label controls)
to a Sub. I tried ParamArray, but it accepts only As Variant and then I
can't use the properties. I would like to know how the Calling statement and
the Called Sub appear.

That would be highly appreciated.



Tue, 31 Oct 2000 03:00:00 GMT  
 Passing an Array of Controls to a Sub

Quote:

>How can I pass an array of controls (for instance, array of Label controls)
>to a Sub.

You can pass it "As Object" or "As Variant". Here's an example...

Private Sub ProcessControlArray(ctlArray As Variant) 'could be As Object
    Dim ctl As Control
    For Each ctl In ctlArray
       'do something
    Next
End Sub

...and in your main code...

ProcessControlArray lblInformation  'where lblInformation is a control array

Frank Carr



Tue, 31 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing Control Arrays to Sub-Procedures

2. Passing control arrays to subs

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

4. Help how to pass control arrays to sub ??

5. How to pass control arrays to subs

6. Pass control array to sub/function ?

7. Passing Control Array to a SUB/FUNCTION

8. pass an array as function/sub argument

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

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

11. Passing Arrays from Sub to Program

12. Help! Problem passing string array to sub

 

 
Powered by phpBB® Forum Software