Text colour.

shamu

Member
Joined
Jan 4, 2010
Messages
16
Programming Experience
1-3
Hi all.

I am trying to conditionally change the colour of some text in a textbox, for example:

If n=> 10 then txtbox1.forecolor = red


This doesn't appear to work, does the textbox need to be a 'rich textbox'

Thanks.
 
If you want to set forecolor for only part of the text RichTextBox control must be used, TextBox control does not support rich text formatting like that.
Those two controls is much like Notepad and Wordpad editors in Windows, one is a plain text editor, the other is a rich text editor.
 
Hi, thanks for the reply.

I need to change the colour of the whole content of the text box, can this be done with a simple textbox?

Thanks.
 
Sure, just set ForeColor property.
 
Back
Top