Click here to Skip to main content
15,886,857 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display the variable 'v_propertytype_name_selected 'in diff color,say green.
My code:

Label1.Text = "Sorry ! no details found as of now for " +v_propertytype_name_selected + "";
Label1.visible=true;


Thanks.
Posted
Comments
B.S.S Pavan Kumar 20-Aug-13 2:34am    
Label1.Backcolor=color.Green
S.Rajendran from Coimbatore 20-Aug-13 2:51am    
I want to present the data in the variable 'v_propertytype_name_selected' in green.

using System.Drawing;

Label1.Backcolor=color.Green
 
Share this answer
 
Hi,

Insert Span tag which contains color attribute

ex:

C#
string spanGreenStart = "<span style="color:green">";
string spanEnd = "</span>";
Label1.Text = "Sorry ! no details found as of now for " 
+spanGreenStart +
+v_propertytype_name_selected + spanEnd;


Hope it helps,

--SJ
 
Share this answer
 
v3
Comments
S.Rajendran from Coimbatore 20-Aug-13 5:58am    
Sorry, it doesnt work.
S.Rajendran from Coimbatore 20-Aug-13 6:12am    
I withdraw my earlier comment. It works! Before I didnt use Label1.Text=true; Thanks.I've accepted your solution.
codeninja-C# 20-Aug-13 6:41am    
You are Welcome :)
You can use Color.FromName() method.

See below link.

Color.FromName Method
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900