<br>
I need to know how to pass a control array into a sub or function.<br>
I have 5 subs for every control, but the logic is identical.<br>
The only thing that changes is the control reference. For example:<br>
<br>
Private Sub RemoveCol(ByVal rTake As Integer)<br>
Dim intCnt As Integer<br>
Dim intC As Integer<br>
intC = lblCol.count<br>
<br>
Do While lblCol.count > (intC - rTake)<br>
intCnt = lblCol.count<br>
If intCnt = 1 Then Exit Sub<br>
Unload lblCol(intCnt)<br>
Loop<br>
<br>
End Sub<br>
<br>
It would save me a lot of work if I could use a sub like this:<br>
<br>
Private Sub RemoveCTL(ctl as control, ByVal rTake As Integer)<br>
Dim intCnt As Integer<br>
Dim intC As Integer<br>
intC = ctl.count<br>
<br>
Do While ctl.count > (intC - rTake)<br>
intCnt = ctl.count<br>
If intCnt = 1 Then Exit Sub<br>
Unload ctl(intCnt)<br>
Loop<br>
<br>
End Sub<br>
<br>
But it doesn't work. <br>
Is it possible with VB6?<br>
<br>
I need to know how to pass a control array into a sub or function.<br>
I have 5 subs for every control, but the logic is identical.<br>
The only thing that changes is the control reference. For example:<br>
<br>
Private Sub RemoveCol(ByVal rTake As Integer)<br>
Dim intCnt As Integer<br>
Dim intC As Integer<br>
intC = lblCol.count<br>
<br>
Do While lblCol.count > (intC - rTake)<br>
intCnt = lblCol.count<br>
If intCnt = 1 Then Exit Sub<br>
Unload lblCol(intCnt)<br>
Loop<br>
<br>
End Sub<br>
<br>
It would save me a lot of work if I could use a sub like this:<br>
<br>
Private Sub RemoveCTL(ctl as control, ByVal rTake As Integer)<br>
Dim intCnt As Integer<br>
Dim intC As Integer<br>
intC = ctl.count<br>
<br>
Do While ctl.count > (intC - rTake)<br>
intCnt = ctl.count<br>
If intCnt = 1 Then Exit Sub<br>
Unload ctl(intCnt)<br>
Loop<br>
<br>
End Sub<br>
<br>
But it doesn't work. <br>
Is it possible with VB6?<br>
<br>