Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic- Color coding fields 1

Status
Not open for further replies.

bradth

IS-IT--Management
Feb 18, 2005
142
CA
This is a pretty basic question, but I'm not sure how to get this to work properly. Basically I have an initialize button that when pressed will either give a true or false. When true, there is a textbox that displays the text "Ready" and if false the textbox displays "Not Ready". What I would like to do is when the textbox says "Ready", have the color of it change to green, and "Not Ready" to red. Is there a line of code that will allow me to do this easily? Thanks for your help.

Brad [spidey]
 
This will change the background color.

textbox.BackColor = vbGreen
textbox.BackColor = vbRed

This will change the color of the text.

textbox.ForeColor = vbGreen
textbox.ForeColor = vbRed

Personally, I try not to mess with background colors. Changing the color of the text is probably how you want to do this.


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
The Textbox control has a BackColor property which you can set. See VBHelp and faq222-2244 paragraph 8

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Cheers gmmastros, works perfect.

Brad [spidey]
 
Glad to help.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top