RichTextBox formatation transter

C

cardososp

How can i transfer formatted data to another RichTextBox ?



I try


richTextBox1.Lines = richTextBox2.lines;
richTextBox1.Text = richTextBox2.Text;

it don't work..
 
B

Bruno Gallett

More information..

richTextBox1.AppendText("[" + DateTime.Now.ToShortTimeString() + "]"+UserName+" >>" , Color.Green);
richTextBox1.AppendText(" ");
richTextBox1.AppendText(message + Environment.NewLine, Color.Blue);



Code:
public static class RichTextBoxExtensions
{
public static void AppendText(this RichTextBox box, string text, Color color)
{
box.SelectionStart = box.TextLength;
box.SelectionLength = 0;

box.SelectionColor = color;
box.AppendText(text);
box.SelectionColor = box.ForeColor;
}
}
 
J

Jeff Johnson

Jeff Johnson said:
How can i transfer formatted data to another RichTextBox ?

Try the RtfText (or is it TextRtf?) property.[/QUOTE]


Argh, it's just Rtf.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top