
How to pass control array ByRef?
Thanks Randy,
I was hoping to retain the control name so that I could keep the "dot"
notation function when coding within the routine.
I have used As Object before, which accomplishes the same, but I loose the
dot notation functionality while coding.
In other words, I know the type of control that will be passed in.
Private Sub cmdButton_Click(Index As Integer)
CheckEm cmdButton
End Sub
Public Sub CheckEm(ByRef rcmdButton() As CommandButton)
Dim lngCounter
rcmdButton.Caption(0) = "Hello 1"
rcmdButton.Caption(1) = "Hello 2"
lngCounter = UBound(rcmdButton)
End Sub
Doesn't look like it is possible under VB?
Cheers, Rob.
Quote:
> 'add a textbox control array to a form ...
> Option Explicit
> Private Sub Command1_Click()
> Call passArray(Text1())
> End Sub
> Public Sub passArray(ctls As Variant)
> ctls(0).Text = "Hello"
> ctls(1).Text = "World"
> ctls(0).BackColor = RGB(255, 255, 0)
> ctls(1).BackColor = RGB(0, 255, 255)
> 'etc etc
> End Sub
> --
> Randy Birch, MVP Visual Basic
> http://www.mvps.org/vbnet/
> http://www.mvps.org/ccrp/
> Under VB6 SP3, is it possible to pass a Control Array byRef.
> If so, how do you pass the control array in the routine call? AND, how is
> the control array defined in the routine?
> Thanks, Rob.