Harry,
Thanks for the help. However, I found another route that works fine. Instead of using richTextBox1->Text ... I use richTextBox1->AppendText( S"\n First line \n second line"). This works fine for me.
So, now I go on with my project.
DAS
----- harry_bosch wrote: -----
=?Utf-8?B?RCBTdGV3YXJk?= said:
Harry,
richTextBox->Text += S"Second line";
where pointer arithmetic is not allowed.
Hmm, too much native C++ for me lately
This is managed code, so String
is immutable. I would then use StringBuilder to create the complete string,
and then assign it to the Text property (if, for instance, in your real
system you are doing more than just these two short lines).
I haven't checked the syntax on this, but you could also just assign to
Text the concatenation of its current value with the new text you want to
append. Something like:
richTextBox->Text = richTextBox->Text + S"Second line";
I would opt for a StringBuilder, however, instead of this, unless testing
has shown that the difference is negligible.
A quick look in the .NET docs shows that RichTextBox (via its base class)
has a Lines property, which allows you to assign lines to a multiline
control by index. Then you could do something like:
richTextBox->Lines[0] = S"My first line";
richTextBox->Lines[1] = S"My second line";
I've never used these classes, so the above is completely untested.