I have a panel on a form containing various controls.
If I want to set all controls in the panel to a
certain set of characteristics, I can code the following:-
Dim conMyControl As Control
For Each conMyControl In MyPanel.Controls
conMyControl.ForeColor = Color.Blue
conMyControl.BackColor = Color.Wheat
Next
Is there a way I can code the same sort of logic just
for a specific control type, for example a textbox?
I've tried the following but I get a runtime compile
error even though I think I've done something like this before in the past, I can't remember how I did it.
Dim conMyControlTextBox As textBox
For Each conMyControltextBox In MyPanel.Controls
conMyControl.ForeColor = Color.Blue
conMyControl.BackColor = Color.Wheat
Next
If I want to set all controls in the panel to a
certain set of characteristics, I can code the following:-
Dim conMyControl As Control
For Each conMyControl In MyPanel.Controls
conMyControl.ForeColor = Color.Blue
conMyControl.BackColor = Color.Wheat
Next
Is there a way I can code the same sort of logic just
for a specific control type, for example a textbox?
I've tried the following but I get a runtime compile
error even though I think I've done something like this before in the past, I can't remember how I did it.
Dim conMyControlTextBox As textBox
For Each conMyControltextBox In MyPanel.Controls
conMyControl.ForeColor = Color.Blue
conMyControl.BackColor = Color.Wheat
Next