Re: Passing control array as parameter
Quote:
Originally Posted by
mark sreeves
this works:
Code:
option explicit
dim captions(4) as string
private sub command1_click()
setcaption label1, captions
end sub
private sub form_load()
captions(0) = "hello"
captions(1) = "hello"
captions(2) = "hello"
captions(3) = "hello"
end sub
public sub setcaption(labelctrl as variant, data() as string)
dim i as integer
for i = 0 to ubound(data) - 1
labelctrl(i).caption = data(i)
next
end sub
------------------
mark sreeves
analyst programmer
[email protected]
a bmw group company
yahooo!!!! You saved me!!!!!!
Re: Passing control array as parameter
Another solution to a 13 year old unresolved problem:
Code:
Private Sub SetCaptions(ByVal LabelArray As Object, ParamArray Captions() As Variant)
Dim i As Integer, LB As Integer, UB As Integer
LB = LabelArray.LBound
UB = LabelArray.UBound
If LB = LBound(Captions) Then
If UB <= UBound(Captions) Then
On Error Resume Next
For i = LB To UB
LabelArray(i).Caption = Captions(i)
Next
End If
End If
End Sub