Question

I want to make bold just the "name" in the string, how to do it?

Dim name As String = Environment.UserName
LabelWelcome.Text = "Welcome " + name + ", ...!"
Was it helpful?

Solution

I don't believe this is do-able on default labels since there is no style formatting.

I suggest to use 2 labels or a rich text box control.

OTHER TIPS

You can use two labels and put them side by side. One having the bold part and other having the simple text.

You can use the OnPaint() method for custom drawing also

I found this : http://pastebin.com/L4xScMjZ [Not made by me]
It's a class that highlights part of a label for you. It doesn't bold it, but you can highlight the important part in red or any color you want.
I'm sure you could turn this to make the highlighted part bold as well.
To use it, you create a new class and put that code in.
Build your project and there should be a new control called "Scrolling Label"
You can add that control to your project and edit the properties :
Highlight : # --> how many characters you want it to highlight from left to right
HighLightText --> The color of the highlighted text
This is a bit buggy so you might want to add "DoubleBuffer = True" in your form Load

For those who still Google this: You can make a function which replaces your characters with some unicodes. You can use most of WorksheetFunction.Unichar(119808) to WorksheetFunction.Unichar(120831)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top