我想通过单击按钮向表单添加标签。当我在这里使用代码时,它只添加了 1 个标签,但我想添加无限量。每次单击按钮时,即使更改名称,它也只会添加 1 个标签。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lbl As New label
lbl.Size = New System.Drawing.Size(159, 23) 'set your size
lbl.Location = New System.Drawing.Point(12, 180) 'set your location
lbl.Text = (TextBox1.Text) 'set your name
Me.Controls.Add(lbl) 'add your new control to your forms control collection
End Sub