TextBox & Backcolor

A

Agnes

When the textbox 's Enabled = True, (its backcolor is white)
When the Textbox got focus (backcolor change to pink by my code)
when the textbox lost focus(back color change to white by my code)
NOw. the problem is "When textbox 's Enabled = false. ( the back color still
white but not gray)
Does anyone know how to solve this problem ??
thanks a lot
 
H

Herfried K. Wagner [MVP]

Agnes said:
When the textbox 's Enabled = True, (its backcolor is white)
When the Textbox got focus (backcolor change to pink by my code)
when the textbox lost focus(back color change to white by my code)
NOw. the problem is "When textbox 's Enabled = false. ( the back color
still white but not gray)

Set the control's 'BackColor' to 'SystemColors.Window' instead of
'Colors.White'.
 
P

Phill. W

Agnes said:
When the textbox 's Enabled = True, (its backcolor is white)
When the Textbox got focus (backcolor change to pink by my code)
when the textbox lost focus (back color change to white by my code)
NOw. the problem is
"When textbox 's Enabled = false (back color still white not gray)

If the control is disabled, if /can't/ receive focus, so any Focus event
handlers you have won't get a look in.

Try handling the [TextBox].EnabledChanged Event as well as the
focus ones.

HTH,
Phill W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top