Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

This may seem Simple to some of you but im curious im making a simple application and i want to change a word within a label.

The label Currently stands as = "how much cash do you want?"

I want to change the colour of "Much"

Can some one point me in the direction of show an example please.

Thanks in advance. :)
Posted

If it is a Windows Forms application I do not know a way to do that with one label.

What you can do is have three labels
1. "How"
2. " Much" set the ForeColor to whatever you want.
3. " Cash do You Want?"

You might want to put them on a panel or make them into a user control to make alignment and moving easier.
 
Share this answer
 
v2
Ok, I know you are specifically asking about "label" control, but wouldn't richtextbox control better suited to do this? HTH.

Check this for instance:
http://www.startvbdotnet.com/controls/rtb.aspx[^]
 
Share this answer
 
v2
Comments
#realJSOP 27-Nov-10 6:37am    
If you don't want to use multiple controls, this is the only way. Of course, this is assuming he's writing a winforms app, and not something for the web. I don't know why your answer was 1-voted, because with the info we have it's the best answer provided so far. I voted it up.
iris.frigole 27-Nov-10 22:49pm    
Yes, I assumed winforms and probably the question was for web development, you are very much right.
I would use 3 labels contained side by side. If you do not want to go that route. Here is an example in c# that can help you.

http://stackoverflow.com/questions/275836/multiple-colors-in-a-c-net-label[^]
 
Share this answer
 
i did think i would have to use 3 labels, but its just that i saw an article on reading a file and then highlighting the word within the sentence it reads just wondered if it could be done with one label,
But thanks for the feedback

one quick question regardng a colour would you be able to tell me what colour this back ground is on here www.wonga.com behind the dual Sliders ?
 
Share this answer
 
Comments
badprog 26-Nov-10 14:37pm    
Print Screen...
Open MS Paint.
Use the color selector.

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