2012-04-03 5 views

Antwort

24
TextBox1.ForeColor = Color.Red; 
TextBox1.Font.Bold = True; 

Oder dies kann (empfohlen) mit einem CssClass erfolgen:

.highlight 
{ 
    color:red; 
    font-weight:bold; 
} 

TextBox1.CssClass = "highlight"; 

Oder die Stile inline hinzugefügt werden können:

TextBox1.Attributes["style"] = "color:red; font-weight:bold;"; 
3

Try Verwenden der Eigenschaft ForeC olor. So:

TextBox1.ForeColor = Color.Red; 
1
string minusvalue = TextBox1.Text.ToString(); 

if (Convert.ToDouble(minusvalue) < 0) 
{ 
    // set color of text in TextBox1 to red color and bold. 
    TextBox1.ForeColor = Color.Red; 
} 
Verwandte Themen