> how do I pass a whole control array to a sub? is there a way to do this
> in Visual Basic 6? any help will be nice, thanks in advance.
[quoted text clipped - 3 lines]
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Control arrays need to be passed as Object. If you start a new project,
create a control array of textboxes called Text1(0-n) and drop a command
button on the form, you'll see one way of doing it.
'===========
Option Explicit
Private Sub Command1_Click()
Call SetColors(Text1)
End Sub
Private Sub SetColors(AControlArray As Object)
Dim o As TextBox
'Set the back color
For Each o In AControlArray
o.BackColor = RGB((Rnd * 127 + 128) _
, (Rnd * 127 + 128), (Rnd * 127 + 128))
o.ForeColor = RGB(Rnd * 127, Rnd * 127, Rnd * 127)
Next
End Sub
'===========

Signature
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
Miguel Martinez - 28 May 2004 17:38 GMT
thanks, I've done a test five minutes ago and it seems to work, you save
me a lot of work of typing a lot of code.
you're the best!!
Miguel Martinez