Using VB.NET 2010 / WinForms
I have a panel named "Panel1", and 3 buttons inside that panel. In the form's load event, I am creating a small red square, and want to put that red square inside each of the 3 buttons...
Dim RedSquare As New Panel
With RedSquare
.Top = 0
.Left = 0
.Width = 10
.Height = 10
.BackColor = Color.Red
End With
For Each Control As Control In Panel1.Controls
If TypeOf Control Is Button Then
Control.Controls.Add(RedSquare)
End If
Next
But the small red square only appears inside the 1st button.
What am I doing wrong?