In VB6 it is legal to reference a control array element before actually creating it, as in this code:
Set cmdTemp = Command1(1)
Load cmdTemp
cmdTemp.Caption = "New Button"
cmdTemp.Visible = True
While VB Migration Partner handles most of control arrays’ features, this particular syntax cannot be automatically translated to VB.NET. You can solve this problem by changing the original VB6 code into:
Load cmdTemp(1)
Set cmdTemp = Command1(1)
cmdTemp.Caption = "New Button"
cmdTemp.Visible = True
or by means of a combination of pragmas:
Set cmdTemp = Command1(1)
Load cmdTemp
cmdTemp.Caption = "New Button"
cmdTemp.Visible = True