Computer Science Canada

[VB 2005 Express]Multiple Lines on a RichTextBox?

Author:  Raku [ Fri Sep 21, 2007 6:17 pm ]
Post subject:  [VB 2005 Express]Multiple Lines on a RichTextBox?

Ok..So I used the tool box to create a RichTextBox, and I'm trying to make it so it will output multiple lines when I click the button I'm using. I want it to output something like:

Level: lvl(the variable)
Attack: atk
Defense: def
Stamina: stm

etc. in the RichTextBox..how can I do this? Or is there something else I need to use to output something like this?

Author:  rdrake [ Fri Sep 21, 2007 6:45 pm ]
Post subject:  RE:[VB 2005 Express]Multiple Lines on a RichTextBox?

Make sure the MultiLine property is set to true. I believe you want to use the Append() method to add text to what's already there.
code:
rtb.MultiLine = true;
rtb.Append("Line 1\nLine 2");
Pretty much a guess as I'm too lazy to whip open Visual Studio, but that sounds about right.

EDIT: On second thought, it's probably more like this:

code:
rtb.MultiLine = true;
rtb.AppendText("Level:  " + lvl + "\nAttack:  " + atk + "\nDefense:  " + def + "\nStamina:  " + stm);


: