Forums - C# Corner

Forum guidelines
Craig Kasold

Craig Kasold

  • 758
  • 4
  • 32.8k

Change the foreColor of a textbox

Feb 11 2009 9:04 AM
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)

C# Corner Chandigarh Developer Conference

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.