I understand how to loop through regular controls on a form. For example, if I wanted to change the background color of all panels on a form to red, I would do this...
Dim IndividualControl As Control
For Each IndividualControl In Me.Controls
If (TypeOf IndividualControl Is Panel) Then
IndividualControl.BackColor = Color.Red
End If
Next IndividualControl
But let's say that instead of changing the properties of all the panels on a form, I want to change the properties of all of the web browser controls on a form (don't ask why I have several instances of the webbrowser control on a form -- it's a long story, and is simply what the project requires :)
So for example, if I wanted to change the "ScriptErrorsSuppressed" property to TRUE for all WebBrowser controls on a form, I assumed that the following code would work, but it doesn't (it just returns an error stating "ScriptErrorsSuppressed is not a member of System.Windows.Forms.Controls".
Dim IndividualControl As Control
For Each IndividualControl In Me.Controls
If (TypeOf IndividualControl Is WebBrowser) Then
IndividualControl.ScriptErrorsSuppressed = True
End If
Next IndividualControl
So... any ideas how to pull this off? Using VB2010 / Winforms