I want to copy content of control array to another control array, is it possible in VB6? please help
Asked
Active
Viewed 171 times
0
-
What do you want to achieve? The array is a list of object references with some extra plumbing so there is little point in copying, you would end up with a list of the same references. Did you mean clone? – Alex K. Aug 05 '15 at 10:14
-
I have a control array of labels, and need to take a duplicate copy of it to perform deletion of elements from the original array and update it after deletion. – Anugrah Aug 05 '15 at 10:19
-
1why cannot you just do it? Go through the control array and make copies by setting properties – Rob Aug 05 '15 at 13:29
1 Answers
0
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.

BobRodes
- 5,990
- 2
- 24
- 26