Anybody have any idea about how to change the font of the string.
Suppose

Dim strFind as string="Answer"

I want to change the font of the string as "Verdana"
Purpose behind that, I have an richtextbox1 contains the questions and richtextbox2 contain the answer so while concating i want to append text "Answer" before answer. but these concatenate string then displayed in richtextbox3. But the appended text showing in diff. font while question in different font (question has "Bookman Old style7" font)
can anybody help me.
Thanks in advance........

Recommended Answers

All 2 Replies

Dim str1 As String = "Your string"
        RichTextBox1.Text = str1
        RichTextBox1.SelectionStart = RichTextBox1.Find(str1)

        RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Bold)

New Font(RichTextBox1.Font, FontStyle.Bold) is having many overloaded methods probalbly you can get something there

Hi, Pgmer
U r right but the string is not in richtextbox i am append it ouside .

rtxtAll.AppendText("Soln.- ")
                    rtxtAll.AppendText(Environment.NewLine)
                    rtxtAll.AppendText("    ")
                    rtxtAll.SelectedRtf = rtxtsolution.Rtf
                    rtxtAll.AppendText(Environment.NewLine)
                    str_concat = (str_concat _
                                & (Environment.NewLine _
                                & (Environment.NewLine & rtxtAll.Rtf)))

I think i can resolve this by set the richtextbox font to "Requiredfont" and then copy this rtf string to another richtexrbox.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.