I created two Labels dynamically based on a vector according to the code below, however, in the form only the last Label created (NewLabel1) remains, both the first (NewLabel0) and the Label that I used the base for the creation of the other two (Label1) do not remain.
I need to create several Labels according to the number of items I want to work on (one for each product of a certain line of cosmetics, for example), so the need to use a vector. How can I solve this?
Dim NewLabel(1) As Object
Set NewLabel(0) = Label1 'Label1 existe no formulário
Set NewLabel(1) = Label1
With NewLabel(0)
.Caption = "NewLabel0"
.Top = 0
.Left = 0
End With
With NewLabel(1)
.Caption = "NewLabel1"
.Top = 20
.Left = 20
End With
...
...
...
NewLabel(0).Delete
NewLabel(1).Delete