Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

Insert Text from RichEdit1 -to- RichEdit2 (At the Bottom (or) Top) of the file.

Hello All;

I am stripping out certain lines from RichEdit1 -to- RichEdit2.
I am then Editing the Line(s) in RichEdit2, then I need to copy the line(s) Back to the RichEdit1.
I either need to have the lines added to either the [Beginning] (or) [End] of the RichEdit
(Start from it's own line, not connecting onto another line)

I have searched around on Google, and the information that I have found is dated all the way back
To: 1999 - From Peter Below.
And he states that it cannot really be done.
So "Hopefully" someone has found a way to do this in the past 7yrs :)

Take Care All.
Carrzkiss (500 Points will be awarded for a Good Working Code, that must be "ROBUST" as the files
Are HUGE in Lines. Up to and beyond 5,000)
But will look at anything, since it is just adding lines, it may not make a big difference, as long
As it can read from Each control fast enough.
ASKER CERTIFIED SOLUTION
Avatar of Mike Littlewood
Mike Littlewood
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wayne Barron

ASKER

I will give it a shot, and let you know here is a few.
Thanks Mike.

Wayne
Hi,

Use the following it will work with formatted text also.

RichEdit2.SelectAll;
RichEdit2.CopyToClipboard;
RichEdit1.SelStart := 0; // 0 = INSERT, LENGTH(RichEdit1.Text)-1 = APPEND
RichEdit1.SelLength := 0; // this will prevent from overwrite if something is selected
RichEdit1.PasteFromClipboard;

In fact you might not even need the #10#13 as it seems to stick in an extra break anyway.
Man, I need to slow down and take notice.
That was such a simple over-site it is unreal.

I was first trying:

RichEdit1.Text := RichEdit2.Text
Which would not work, never dawned on me to add in that little bit of # information.
(Of which I am just using the #10 by itself, as I need it simply added to the very bottom of the line.
The #10#13 will create a [WhiteSpace] between the Bottom Line, and the added Line(s).

Thank you once again Mike, and making me remember.
Though it was a simple one, I promised 500-Points.
And you shall receive 500-Points. (2000 in reality :) )

Take Care Mike;
Wayne
Sorry [atul_parmar], I had already started typing and Accepted Mike's information as [Answer]
Before I had a chance to read your information.
I used the code from Mike.
Thanks, glad I could point you in the right direction.