Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Static Counter As Integer
Counter += 1
Dim myNewLabel As New Label
With myNewLabel
.Name = "Label" & Counter
.Text = "New Label"
.Left = 100
.Top = 20 * Counter
End With
Me.Controls.Add(myNewLabel)
End Sub
End Class
Thanks Ian!
Please help me in somthing else:
Some of the Labes that are located on the Form are hidden by other controls (such as PictureBox).
How to bring theme always to the top of the Form? I tryed "BringToFront()", but it doesn't do the job.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Static Counter As Integer
Counter += 1
Dim myNewLabel As New Label
With myNewLabel
.Name = "Label" & Counter
.Text = "New Label"
.Left = 50
.Top = 20 * Counter
End With
Me.Controls.Add(myNewLabel)
myNewLabel.BringToFront()
End Sub