Je remet un exemple plus explicite.
LABEL1 stay red in my groupbox
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.ForeColor = System.Drawing.Color.DimGray
Me.GroupBox1.Location = New System.Drawing.Point(12, 12)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(237, 127)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "MASM32"
'Move (AddControl) at the end of definitons from Me.GroupBox1
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.Button1)
'Add code here
Dim ThisObject As Object = Nothing
For Each ThisObject In Me.GroupBox1.Controls
Select Case ThisObject.GetType
Case GetType(Label)
ThisObject.ForeColor = Color.Black
Case GetType(Button)
ThisObject.ForeColor = Color.Black
End Select
Next
ThisObject = Nothing
'
'Label1
'
Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Label1.ForeColor = System.Drawing.Color.Red
Me.Label1.Location = New System.Drawing.Point(137, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(96, 15)
Me.Label1.TabIndex = 2
Me.Label1.Text = "should work ..."
...