Thymen
02-25-2006, 05:19 AM
Hi folks,
if I set the option Enabled of a control on a form to False, then the text get's greyed out. Instead of greying out the forecolor I want to change the backcolor, and that works fine. But how to change the ForeColor of a disabled control to vbBlack? It appears the Enable setting overrules that...
For Each Ctrl In Userform1.Controls
If (TypeOf Ctrl Is MSForms.TextBox) Or (TypeOf Ctrl Is MSForms.CheckBox) Then
Ctrl.Enabled = False
If (TypeOf Ctrl Is MSForms.TextBox) Then
Ctrl.BackColor = &H80000018
Ctrl.ForeColor = vbBlack
End If
End If
Next Ctrl
Here, Ctrl.ForeColor = vbBlack has no effect
Regards,
Thymen
if I set the option Enabled of a control on a form to False, then the text get's greyed out. Instead of greying out the forecolor I want to change the backcolor, and that works fine. But how to change the ForeColor of a disabled control to vbBlack? It appears the Enable setting overrules that...
For Each Ctrl In Userform1.Controls
If (TypeOf Ctrl Is MSForms.TextBox) Or (TypeOf Ctrl Is MSForms.CheckBox) Then
Ctrl.Enabled = False
If (TypeOf Ctrl Is MSForms.TextBox) Then
Ctrl.BackColor = &H80000018
Ctrl.ForeColor = vbBlack
End If
End If
Next Ctrl
Here, Ctrl.ForeColor = vbBlack has no effect
Regards,
Thymen