Label Font Color

I want to set my label's font color. I tried the below code (and I tried other things that didn't work too).

lblMessage.font.color=red
LVL 1
net_susanAsked:
Who is Participating?
 
TheMehrdadCommented:
Hi,
I thought you have imported the System.Drawing,
You may use it in this way:
lblMessage.ForeColor=System.Drawing.Color.Red

Or you may add this line to the first line of the module:
Imports System.Drawing

And then write this code:
lblMessage.ForeColor=Color.Red

Good luck
0
 
TheMehrdadCommented:
Hi, at runtime, use: lblMessage.ForeColor=Color.Red
Good luck
0
 
net_susanAuthor Commented:
Compiler Error Message: BC30451: Name 'Color' is not declared.
0
 
net_susanAuthor Commented:
Oh, I actually had a solution in a different question of mine.

      lblMessage.cssclass="someclass"


But, I'm still curious why I can't make it work the other way.
0
 
quanmacCommented:
You could do this:

lblStatus.ForeColor = "red";

That will make your font red.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.