I am adding many panels to a FlowLayoutPanel, by going through a database and adding a panel with relevant labels for each entry in the database. I need to be able to then be able to code what happens when any of the panels are clicked on, but am unable to work out how.
This is the code I use to generate the panels
For i As Integer = 0 To IDs.Count - 1
Dim testPanel As New Panel With
{
.Height = 50,
.Width = 140,
.BackColor = Blue,
.Name = "rPanel" + i.ToString
}
FlowLayoutPanel.Controls.Add(testPanel)
Next