locked
Use of Rich Text Box RRS feed

  • Question

  • I want to present the results of queries in a rich text box. My results will mainly be summaries of grouped data thus:

    Category1 - <name>
        Subcategory1 - <name>  $99,999.99
        SubCategory2 - <name>  $99,999.99
        Subcategory3 - <name>  $99,999.99

        Category1 Total            $99,999.99

    Category2 - <name>  ......

    I understand that I could 'add' lines to the rich text box either by repreated assignments to the rich text box Text
    property e.g RichTextBox1.Text = "Line 1 xxxxxx" or by using the Lines array
    e.g.. myLines(0) = "[using Lines] Line 1 xxxxxx" ,  myLines(1) = "[using Lines] Line 2 yyyyyy"

    Does either method have any particular advantages over the other? If I use the Lines array do I need to bother
    about inserting new line chracaters into the data?

    Are there any decent tutorials on how to use the rich text box in this way? Is this an appropriate use of a
     rich text box?

    Thanks


       
    Friday, November 21, 2008 5:07 AM

Answers

  • You can't use the Lines property, it doesn't have an Add() method.  Use AppendText("\n" + "another line").  I wouldn't use an RTB for this, but just draw the text in a scrolling panel's Paint event.  But RTB will work too.
    Friday, November 21, 2008 10:55 PM

All replies

  • You can't use the Lines property, it doesn't have an Add() method.  Use AppendText("\n" + "another line").  I wouldn't use an RTB for this, but just draw the text in a scrolling panel's Paint event.  But RTB will work too.
    Friday, November 21, 2008 10:55 PM
  • Thanks - I've just discovered AppendText and tha works fine for me.
    Saturday, November 22, 2008 5:22 AM