So I need to create an array of labels and I dont know the final size of the array. I declare it in the class section
Dim myPoints() As Label
in the program I fill the array
Dim l As New Label
l.Width = 4
l.Height = l.Width
l.BackColor = Color.Red
l.Visible = True
l.Left = pointA.X - 2
l.Top = pointA.Y - 2
l.Name = CStr(i)
myPoints(i) = New Label
myPoints(i) = l
AddHandler l.Click, AddressOf l_Click
Panel1.Controls.Add(myPoints(i))
when I run the program I get object reference not set Error is there a way to to do it with no declaration of the array size ?