Board index » delphi » how to copy from TMemoField to TMemoField ?

how to copy from TMemoField to TMemoField ?

Hello,
  Anyone know how to copy the contents of one memo field
to another?
  Thanks.

---------------------------------------------------
Larry MacNeill          Larry.MacNe...@UCHSC.edu
University of Colorado Health Sciences Center
4200 E. 9th Ave., C-249
Denver, Colorado 80262
---------------------------------------------------

 

Re:how to copy from TMemoField to TMemoField ?


Quote
Larry MacNeill wrote:

> Hello,
>   Anyone know how to copy the contents of one memo field
> to another?
>   Thanks.

You may use Assign method. To copy the contents of MemoField2
to MemoField1, try

  MemoField1.Assign(MemoField2.Lines);

--
FANG LUO                   |
New Mexico Bureau of Mines | E-mail: fa...@prism.nmt.edu
Campus Station             | Office: (505) 835-5627
Socorro, NM 87801          | Fax   : (505) 835-6333

Re:how to copy from TMemoField to TMemoField ?


Quote
Larry MacNeill (Larry.MacNe...@UCHSC.edu) wrote:

:   Anyone know how to copy the contents of one memo field
: to another?
This really becomes a frequently asked question. One of the best ways to do
it is to use streams.

var BS:TBlobStream;
begin
   try
      BS := TBlobStream.Create(MemoField1, bmRead);
      MemoField2.LoadFromStream(BS);
   finally
      bs.free;
   end;
end;

Hope that helps,
    Andy

--
----------------------------------------------------------------------------
Andreas H"orstemeier                       | "We are not interested in
email: hoer...@hal1.physik.uni-dortmund.de | little green men, but in little
       a...@farpoint.sauerland.de          | green women."
fido:     2:2444/4505.3                    | (Edwin "Buzz" Aldrin)
astronet: 122:490/1.53                     |
----------------------------------------------------------------------------  

Re:how to copy from TMemoField to TMemoField ?


On 22 Jan 1996 22:19:33 GMT, Larry.MacNe...@UCHSC.edu (Larry MacNeill)
wrote:

Quote
>Hello,
>  Anyone know how to copy the contents of one memo field
>to another?
>  Thanks.

Try this:

memSecond.Lines.Assign(memFirst)

Its what I use.

Regards
   Glen

Re:how to copy from TMemoField to TMemoField ?


LM>Hello,
LM>  Anyone know how to copy the contents of one memo field
LM>to another?
LM>  Thanks.

I just figured this out myself a few days ago. Use the TMemoField's
Assign procedure.

Regards,

Jani

--
---------------------------------------------------------------------
Jani Jarvinen, Helsinki Finland          jani.jrvi...@hiway.fipnet.fi

Check out Help Editor 2.0 for Windows at:
ftp://ftp.mpoli.fi/metropoli/windows/utils/hlped20.zip

1996: Only four years to computer confusion!
What have you done to avoid it?
---------------------------------------------------------------------
---
 * SLMR 2.1a *

Re:how to copy from TMemoField to TMemoField ?


Quote
Fang Luo wrote:

> Larry MacNeill wrote:

> > Hello,
> >   Anyone know how to copy the contents of one memo field
> > to another?
> >   Thanks.

> You may use Assign method. To copy the contents of MemoField2
> to MemoField1, try

>   MemoField1.Assign(MemoField2.Lines);

The correct code should be:

   MemoField1.Assign(MemoField2);

Sorry for my earlier mistake.

--
FANG LUO                   |
New Mexico Bureau of Mines | E-mail: fa...@prism.nmt.edu
Campus Station             | Office: (505) 835-5627
Socorro, NM 87801          | Fax   : (505) 835-6333

Re:how to copy from TMemoField to TMemoField ?


Quote
Fang Luo wrote:
> You may use Assign method. To copy the contents of MemoField2
> to MemoField1, try

>   MemoField1.Assign(MemoField2.Lines);
> Did you really try this? Both in the documentation and according to the

error message I get, there is NO property LINES in TMemoField!!!

Hans Zorn

Other Threads