I know this is silly, but I am unable to change the colors of my controls by either the properties panel or with code. Anyone ever have this problem? Im using the latest version of Visual studio. the Code i am using is
if (value1 > value2)
this.temp.ForeColor = Color.Yellow;
Basically I would like my text color to change to yellow while the value2 is lower than value1 when they are equal green and over red.
I know I dont have the Green or the red written in, although I can not even get yellow to display, it comes out black (no change). If anyone can help that would be great! Thanks in advance!
Yeah I guess I should have said that I already did that before. Ive even set a break point inside the IF to make sure that it steps inside and runs the line of code, and it does every time its supposed to but alas no color change.
Are there any settings that I would have to change in order to be able to change the color of text in a text box? Im really at a loss as to why my text is ONLY black. Even if I change the foreground to a different color it stays black.
Yes, we need to see more. The name of the member field (temp) looks awfully suspicious - maybe you've mixed up a control or two...
So - post at least the containing method, and tell us what temp is, why it's called "temp" (what's temporary about it) and where it's value is coming from.
Sadly my project is far to large for me to post the entire code, although I did discover my issue. It would seem in I am not allowed to change the color on "Read only" set text box. When I make read Only = false, the color of my text changes.
My next question is, Is there any way for me to not allow the user to click into the text box? Or would I be better off using a Label? I only want information display on this particular control, so if a label is a better Idea maybe Ill do that. Thanks!
If by "not allow the user to click into" means that the control shouldn't be editable - then you should use a label. (You can still detect a click, and do something if you want, but the user can't edit the text the way a text box makes it possible).
Yes it looks like Labels is the way to go for me. Sorry for all the silly questions I ask, Ive really only been working in the software engineering field for about 4 months now. Oh and temp is for temperature not temporary. Checking the values of temperatures on some machines VS the set temperature on the hardware controls. If the Machine is below the set temp the text is to be yellow, if its on the temp green, if its above the temp red. Simple enough just didnt know I couldnt change the colors of a read only text box. Now I know, knowing is half the battle yada yada yada all american hero or something.
Last edited by DKS1282; May 13th, 2011 at 09:00 AM.