Forums - C# Corner

Forum guidelines
Craig Kasold

Craig Kasold

  • 1.3k
  • 6
  • 33.2k

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 Annual Conference 2017

SPONSORED BY

File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!