codice:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim lb As List(Of Control) = l.GetChildControls(Me.Form, GetType(Button))
For Each b As Button In lb
b.BackColor = Color.Green
Next
End Sub
Public Function GetChildControls(ByVal container As Control, ByVal type As Type) As List(Of Control)
Dim result As New List(Of Control)()
For Each ctrl As Control In container.Controls
If ctrl.GetType Is type Then
result.Add(ctrl)
End If
result.AddRange(GetChildControls(ctrl, type))
Next
Return result
End Function