How to create a form with a button add_subjects
which adds one textbox
and a corresponding label on each click,3 buttons - Add, Edit and Dele
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Call AddTextBox()
End Sub
Sub AddTextBox()
Dim i As Integer = 1
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then
i = i + 1
'MsgBox(i)
End If
Next ctrl
Dim Label As New Label
Label.Name = "Label" & i
Label.Size = New Size(170, 20)
Label.Location = New Point(200, (20 + (i * 55)))
Label.Text = "Lbl" & i
Dim Textbox As New TextBox
Textbox.Name = "Textbox" & i
Textbox.Size = New Size(170, 20)
Textbox.Location = New Point(200, (38 + (i * 55)))
Me.Controls.Add(Label)
Me.Controls.Add(Textbox)
End Sub