Следующий код выдает сообщение : "Value of type '1-dimensional array of System.Windows.Forms.Label' cannot be converted to 'System.Windows.Forms.Control'."
- Код: Выделить всё
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim LblArray(2) As Label
Dim Lbl As New System.Windows.Forms.Label
Dim i As Integer
For i = 0 To 2
Lbl = New Label
Lbl.Name = "Lab" & i + 1
Lbl.Text = Lbl.Name
Lbl.Visible = True
Lbl.Size = New Drawing.Size(200, 20)
Lbl.Location = New Drawing.Point(10, 70 + 25 * i)
LblArray(i) = Lbl
Next
Me.Controls.Add(LblArray)
End Sub
End Class