Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RichEdit-->quick 1

Status
Not open for further replies.

larcrik

Programmer
Aug 29, 2007
11
DE
I need some help with a RichEdit component.
I want to copy some lines from one RichEdit box to another RichEdit box, and I just don't seem to find the write code.
I want it to be something like this:

for(int i=0;i<14;i++)
RichEdit1->Lines= RichEdit2->Lines
...something like this. Can anyone help me pls?
Thanks.:D
 
Look up the documentation on TStrings - that's what the Lines property is. Think of it as a vector - you can't just assign to the vector, you have to work with it.

Try something like this:

for(int i=0;i<14;i++)
RichEdit1->Lines->Append(RichEdit2->Lines)

or if you want more control over the position of the lines:

for(int i=14;i>0;i--)
RichEdit1->Lines->Insert(5, RichEdit2->Lines)

There's also AddStrings and a bunch of other handy things too.
 
Thank you. I'm a new user of Cbuilder and I'm not really familiar with the programm. The code does not work because Append and Insert need AnsiString and RichEdit->Lines returns a TString. That's my dilema. I just can't make it work. So if you could just take a look on that I'd really apreciate it.
Thanks.:D
 
Off the top of my head, maybe you ought to try
Code:
RichEdit1->Lines->Append(RichEdit2->Lines->Strings[i])
or something similar.


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Thank you for the tips 2ffat. I've finished my project with your help. The code worked just fine.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top