Groups | Blog | Home
all groups > asp.net > february 2007 >

asp.net : Simple Change Label ForeColor


Phillip Vong
2/11/2007 9:46:59 PM
Newbie learning in VB.NET

Stupid question.

I have Label1.Text = "Hello World"

How do I change the Forecolor in code? I know how to set it using VS but I
want to change the Forecolor depening on certain scenerios.

Thanks!

Nathan Sokalski
2/12/2007 1:38:35 AM
You would simply use the ForeColor property. If you want to set it depending
on different conditions, use an if statement like the following:

If Label1.Text <> "" Then Label1.ForeColor = Color.Black

Hopefully this is enough to get you started on what you needed. Good Luck!
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

[quoted text, click to view]

Phillip Vong
2/12/2007 3:01:08 PM
That's perfect. Thanks!


[quoted text, click to view]

AddThis Social Bookmark Button