I generate controls for TableLayoutPanel dynamically. I have a delete button on each line. When I click this, this line should be deleted.
Dim removeBtn As New Button AddHandler removeBtn.Click, AddressOf DeleteRow tlp.Controls.Add(removeBtn, 5, rowCount)
I did not show the code to add text fields similar to the ones above. I can get the line number of the pressed button. Using this, how to remove all controls from this line.
Private Sub DeleteRow(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim currentRow As Integer = CType(CType(sender, Button).Parent, TableLayoutPanel).GetRow(CType(sender, Button)) 'Using this currentRow, how to delete this Row End Sub
emaillenin
source share