Enabled/Disabled background colors not being consistent?

I have a couple of instances in which I disable some textboxes. When I do that, the background colors change (as they should). When I enable them, they show the enabled color, which is usually the default color of white. However, when I toggle them back and forth, the enabled color doesn't show again....the background color just stays white. What properties do I need to pay attention to or change.

I will say also that my application has a custom color for when the textbox has focus. This is determined by the user. When the textbox loses focus, the backcolor become white again. I have a feeling I'm just not sure which properties I should be working with.

I've attached a screenshot of what I'm talking about.
screen shotThanks
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.

Can you show the code you are using to manage your custom color?
David L. HansenProgrammer AnalystCommented:
As long as you are handling the textbox events each time they enter or leave the control, you should only have to change the color and refresh the control. I've often ran into the same issue you're describing and refreshing the control (after making the change) usually fixes the problem.
Éric MoreauSenior .Net ConsultantCommented:
this is not the normal behavior. your grayed textbox is surely not enabled. can you show your code?
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

BlakeMcKennaAuthor Commented:
I just thought of something....does making a control "ReadOnly" have an affect on the background color? If so, then that would be my issue...
Éric MoreauSenior .Net ConsultantCommented:
Yes ReadOnly grays the control

Experts Exchange Solution brought to you by ConnectWise

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
Jacques Bourgeois (James Burger)PresidentCommented:
A TextBox that is disabled can have its BackColor changed through code.

My feeling is that your routine that switch the BackColor to White when you leave the control does not check beforehand if the control is Enabled or not, and it resets the color on disabled controls.
BlakeMcKennaAuthor Commented:
Thanks guys...that got me thinking! Got it resolved!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.