Change ForeColor of Label control dynamically?

arohacs

New Member
I'm trying to set the ForeColor property of the Label web server control depending on cases. (eg. lblMsg.ForeColor = "blue")<BR><BR>But it causes an error: A value of type "string" cannot be converted to 'System.Drawing.Color'.<BR><BR>Is hardcoding it in the control the only way?<BR>(eg. <asp:Label id="lblMsg" runat="server" ForeColor="blue"/>)<BR><BR>Thanks in advance,<BR>BenIts an object property thing:<BR>Try this<BR>lblMsg.ForeColor = Color.FromName("Green")<BR>..<BR>And the other properties are the same sort of thing ie: <BR>lblMsg.Font.Size = FontUnit.Point(18)<BR>zeg,<BR><BR>Thank u. I got it working now :)<BR><BR>Ben
 
Back
Top