I have a TableLayoutPanel(tlp_printing_content_layer2) with 1 column and 2 row, each cell also contain 1 button, How can i get the column and cell number when button clicked? Because i want to replace the button with another usercontrol
Private Sub btn_printer_Click(sender As Object, e As EventArgs) Handles btn_printer2.Click, btn_printer3.Click, btn_printer4.Click, btn_printer5.Click
Dim currButton As Button = sender
Dim prtp As New ctrl_PrinterPanel
currButton.Dispose()
tlp_printing_content_layer2.Controls.Add(prtp, sender.column, sender.row)
End Sub
sender.column and sender.row is not work... or is that other way to replace the button with other usercontrol?
You can iterate through the columns and rows until you find a
Button
matching the name of your clicked button: