sul seguente codice ottrenco l'errore nullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto.
codice:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TableLayoutPanel1.ColumnCount = 5
TableLayoutPanel1.RowCount = 2
Dim a As New System.Drawing.Point
Dim ar() As System.Drawing.Point
For i = 1 To 10
Dim textA As New TextBox
textA.Name = "text" & i
textA.Margin = New Padding(0, 0, 0, 0)
textA.ReadOnly = True
a = textA.Bounds.Location
ar(i) = a ' <--------------------qui ottengo l'errore----<<
textA.BorderStyle = BorderStyle.None
TableLayoutPanel1.Controls.Add(textA)
TableLayoutPanel1.SetColumn(textA, i)
TableLayoutPanel1.AutoSize = True
Next
End Sub
come posso risolvere?