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

Posted on 2006-05-30
Last Modified: 2010-05-18
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.
Question by:Wayne Barron
    LVL 15

    Accepted Solution

    Well unless Im mistaken just add the 2 bits of text together and insert a line break if you want them to be on their own paragraph.

    Add text to end
    RichEdit1.Text := RichEdit1.Text + #10#13 + RichEdit2.Text

    Add text to beginning
    RichEdit1.Text := RichEdit2.Text + #10#13 + RichEdit1.Text

    Or am i missing something special you are trying to do?
    LVL 30

    Author Comment

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

    LVL 10

    Expert Comment


    Use the following it will work with formatted text also.

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

    LVL 15

    Expert Comment

    In fact you might not even need the #10#13 as it seems to stick in an extra break anyway.
    LVL 30

    Author Comment

    by:Wayne Barron
    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;
    LVL 30

    Author Comment

    by:Wayne Barron
    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.
    LVL 15

    Expert Comment

    Thanks, glad I could point you in the right direction.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now