0

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........

2
Contributors
2
Replies
7
Views
5 Years
Discussion Span
Last Post by bhagawatshinde
0
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

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.