HOw do I bold text in a textbox or rich textbox RRS feed

  • Question

  • How do I do text formatting in  a Text Box? I want to bold a selection on a textbox without affecting the rest of the text. HOw do I do this with Textbox and RichText formattting?
    Wednesday, March 9, 2011 8:38 PM


  • You "cannot" make bold a part of text for textbox, but you can make the entire text bold in textbox like this:

    TextBox1.Font = New Font(TextBox1.Font, FontStyle.Bold)

    But, in RichTextBox, it provides a SelectionFont property and you can perform a partial formatting like this:

    ' Make selected text bold programmatically:

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

    ...by instantiating and assigning a new font object with FontStyle.Bold argument.


    Best regards, Saygılarımla, Onur Güzel

    Yazgeliştir Forumları'ndayım.

    Microsoft Haber Grupları Profilim (VB.NET)

    • Proposed as answer by maxter1999 Wednesday, March 9, 2011 11:00 PM
    • Marked as answer by Kee PoppyModerator Wednesday, March 16, 2011 3:13 AM
    Wednesday, March 9, 2011 8:53 PM