Pass a control array to a function? 
Author Message
 Pass a control array to a function?

Does anyone know the correct syntax to pass a control
array to a function? By the way, I am still using VB3.

Thanks in advance.
Mike........



Thu, 27 Apr 2000 03:00:00 GMT  
 Pass a control array to a function?

Control arrays are global in scope via the form object variable.  You can
access them through the form as in:

frmContact.Text1(0).Text = "Contact 1"
frmContact.Text1(1).Text = "Contact 1"
frmContact.Text1(2).Text = "Contact 1"

From anywhere in your program.

If on the other hand you loaded them into an array using the Set command
then you pass it using normal array passing syntax:

Dim aryCtl(0 to 2) As Control
Set aryCtl(0) = frmContact.Text1(0), etc.
Call MyFunction aryCtl

Function MyFunction (Ctls() As Control) <=expecting an array of controls

This should work in versions 3+

Scott



Fri, 28 Apr 2000 03:00:00 GMT  
 Pass a control array to a function?

Pass the control array name without the parentheses. For example:

Call ControlTest(txtInputs)

Sub ControlTest(txtFields As Object)
        'blah blah blah
        'you can refer to each control as txtFields(x) in here
End Sub
--
Hope this helps...

Jeffrey Renton
jrenton AT ees DOT enron DOT com



Quote:
> Does anyone know the correct syntax to pass a control
> array to a function? By the way, I am still using VB3.

> Thanks in advance.
> Mike........



Sat, 29 Apr 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. passing a control array to a function...

2. Pass a control array to a function?

3. Passing a Control Array to a Function

4. Passing a control array to a function

5. How do you pass a control array to a function?

6. Passing control array into global function - problem

7. Passing control arrays into functions - how?

8. how do i pass control array to a function

9. pass control array to function

10. How to pass a control array to a procedure or function

11. can a control array be passed to a function

12. Passing in a control array to a Function??

 

 
Powered by phpBB® Forum Software