Label Fore Color Change To Black When GroupBox Is Disabled.

Hi,

I have a groupbox with several control inside.

When I disable the groupbox, all the label fore color is set to black.

I don't want to change the label fore color.

This is also happened to checkbox.

How to solve this problem?

Thank you.
LVL 1
emi_sastraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SanclerCommented:
When you Enable/Disable a container control, such as a GroupBox, the .Enabled property of all the controls within that follow the setting.  So when you disable your GroupBox the Labels (and Checkboxes) within it are also disabled.  When controls are disabled, the user is given a visual clue by the appearance changing.  That is "by design", I think.  

If you don't want them to follow that behaviour, one idea would be to put them OVER rather than IN the GroupBox.  So far as Labels are concerned, that should cause no problems: because the user can do little to them anyway.  But do you still want the user to be able to change the state of a CheckBox if it is - even only apparently - part of a disabled GroupBox?

Roger
0
Jorge PaulinoIT Pro/DeveloperCommented:
Why don't you loop in all the controls inside the groupbox and disable only the one you like (like checkbox, textbox) ?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

emi_sastraAuthor Commented:
HI Roger,

I think I should disabled all texbox alone inside the groupbox, so it does not change the labels inside the groupbox.

How to do it?

Thank you.

0
emi_sastraAuthor Commented:
HI ee_rlee,

Your link is too complicated for me, and for this case I don't need to make custom controls.

Thank you.
0
emi_sastraAuthor Commented:
Hi jpaulino,

I agree as I just post.

Thank you.
0
Jorge PaulinoIT Pro/DeveloperCommented:
This work for the TextBox and CheckBox. If you want you add more:

For Each ctrl As Control In GroupBox1.Controls
            If TypeOf ctrl Is TextBox Then
                CType(ctrl, TextBox).Enabled = False
            ElseIf TypeOf ctrl Is CheckBox Then
                CType(ctrl, CheckBox).Enabled = False
            End If
        Next
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
emi_sastraAuthor Commented:
Hi jpaulino,

Thank you, that is what I need now.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.