4
Reply

Change the foreColor of a textbox

Craig Kasold

Craig Kasold

Feb 11 2009 9:04 AM
35.2k
I am trying to do something that I believe should be very simple.  I am trying to change the forecolor of a textbox depending on what is in the text box.  Meaning if the text box has a value of 'UP', I want the forecolor to be RED.  If the text box has a value of 'DOWN', I want the forecolor to be BLUE.  I am use to programming in SQL (Oracle) over 10 years ago and I would simply state something like: if the textbox.text  = "UP" then textbox.forecolor = color.red; ELSIF textbox.text = "DOWN" then textbox.forecolor = color.blue; ELSE textbox.forecolor = color.black;

How does one do it in Visual C#?
Can anyone Help?


Answers (4)