locked
Formatting TextBox.Text at Run-Time RRS feed

  • Question

  • Hi

    Is it at all possible to format a part of (say the first line) TextBox text at run time in VB 2010 Express? If yes how please?

    Thanks


    ss
    Tuesday, November 22, 2011 11:19 AM

Answers

  • Better use RichTextBox control.
    Thanks,
    A.m.a.L Hashim
    Microsoft Most Valuable Professional
    Dot Net Goodies
    • Proposed as answer by Bob Wu-MT Thursday, November 24, 2011 6:11 AM
    • Marked as answer by Bob Wu-MT Thursday, December 1, 2011 8:04 AM
    Tuesday, November 22, 2011 12:32 PM
  • The textbox does not offer formating, but rather expects a string.  If you want to format part of a string, then you would use a StringWriter, StringBuilder, or String.Format to prepare the format of the data represented by the object.
     
    If you are talking about colors/fonts/boldness, then A.m.a.l. Hashim has provided a good answer, as the RichTextBox provides those functionalities.

     

    --
    Mike
    • Proposed as answer by Bob Wu-MT Thursday, November 24, 2011 6:11 AM
    • Marked as answer by Bob Wu-MT Thursday, December 1, 2011 8:04 AM
    Tuesday, November 22, 2011 12:45 PM

All replies

  • Better use RichTextBox control.
    Thanks,
    A.m.a.L Hashim
    Microsoft Most Valuable Professional
    Dot Net Goodies
    • Proposed as answer by Bob Wu-MT Thursday, November 24, 2011 6:11 AM
    • Marked as answer by Bob Wu-MT Thursday, December 1, 2011 8:04 AM
    Tuesday, November 22, 2011 12:32 PM
  • The textbox does not offer formating, but rather expects a string.  If you want to format part of a string, then you would use a StringWriter, StringBuilder, or String.Format to prepare the format of the data represented by the object.
     
    If you are talking about colors/fonts/boldness, then A.m.a.l. Hashim has provided a good answer, as the RichTextBox provides those functionalities.

     

    --
    Mike
    • Proposed as answer by Bob Wu-MT Thursday, November 24, 2011 6:11 AM
    • Marked as answer by Bob Wu-MT Thursday, December 1, 2011 8:04 AM
    Tuesday, November 22, 2011 12:45 PM
  • Thank You both Hashim and Mike.
    Sidaan
    Wednesday, November 23, 2011 9:26 PM