Is it possible to copy control array to another control array in VB6?

197 Views Asked by At

I want to copy content of control array to another control array, is it possible in VB6? please help

1

There are 1 best solutions below

0
On BEST ANSWER

You don't need a second control array to hold the values in the labels of the first one, you just need a normal array. Suppose you have a control array of three labels called myLabel:

Dim LabelValues(2) as String
Dim i as Integer

Sub DeleteAndSaveLabelValues
    For i = 0 to 2
        With myLabel
            LabelValues(i) = .Caption(i)
            .Caption(i) = ""
        End With
    Next
End Sub

To replace the label values, just iterate through the control array again and set the Caption to the appropriate array value.