Question Bolding certain characters in a label

kfirba

Well-known member
Joined
Dec 29, 2012
Messages
77
Programming Experience
1-3
Hello!

I'm creating labels with text that I get from a query.
I want to bold certain characters in the output.

Let's say the user searches for "AD"

and one of the result is

"DAD"
I want to bold the AD in the word to be like that:
"DAD"

is it possible?

this is how I generate the label text:
 With myLabel                        .Text = ResultRow("AnimeName")
                        .ForeColor = Color.Black
                        .MaximumSize = New Size(235, 300)
                        .AutoSize = True
                        .Location = New Point(105, 47)
                        .Tag = ResultRow("AnimeID")
                        Cursor = Cursors.Hand
                    End With


Thanks!
 
It's not possible. You can use a RichTextBox and then format your text using RTF or you can use GDI+ to draw multiple Strings with different formatting.

I have tried to use richtextbox but i couldn't get what I want bolded, because when I tried to read the richtextbox content and replace characters, I have received an error. The richtextbox is being made at run-time and I add it into a panel and after I add it into a panel, I tried to bold some certain letters, but it didn't work.

Any idea?
 
While it's fun for us to try to guess what's wrong with your code, it's generally faster if you actually show it to us. It's generally faster still if you explain what you expect the code to do and what it actually does. Withholding obviously relevant information is not the best way to get the help you want.
 
Back
Top