Board index » delphi » Need enlightenment on Memo->Var->Memo

Need enlightenment on Memo->Var->Memo

Been trying to pull the information from a TTable.MemoField and place it into a variable
to hold until I need to place the memo into another record.

Yep, a cut and paste for the Memo.

I mucked around with the Assign and other methods of trying to pull the memo data
from the table and hold it until needed, but it dosn't come out working.

Not sure if I'm screwing up the var declaration of  HoldMemo: TMemo, or the
way I try to pull the data from the database memo field by
Table.FieldByName('MemoData'), or if I should be using some of the
BLOB's instead.

Suggestions (or a bottle of asprin) would be appreciated.

TIA
Steve
snel...@genave.com

 

Re:Need enlightenment on Memo->Var->Memo


SN>Been trying to pull the information from a TTable.MemoField and place it int
SN> variable
SN>to hold until I need to place the memo into another record.

SN>Yep, a cut and paste for the Memo.

SN>I mucked around with the Assign and other methods of trying to pull the memo
SN>ta
SN>from the table and hold it until needed, but it dosn't come out working.

SN>Not sure if I'm screwing up the var declaration of  HoldMemo: TMemo, or the
SN>way I try to pull the data from the database memo field by
SN>Table.FieldByName('MemoData'), or if I should be using some of the
SN>BLOB's instead.

SN>Suggestions (or a bottle of asprin) would be appreciated.

SN>TIA
SN>Steve
SN>snel...@genave.com

I'm not sure if you have already tried this but, here's what I would
use:

  ...
  Interface {in any unit you wish}
  ...
  Var
    MemoData : TStringList;  {declare a list to hold the data}
  ...
  Procedure GetMemoData(FromField : TMemoField);
  Begin
    If (MemoData <> nil) Then MemoData := TStringList.Create;
    MemoData.Assign(FromField); {get data}
  End;
  ...
  Procedure SetMemoData(ToField : TMemoField);
  Begin
    If (MemoData <> nil) Then Begin
      ToField.Assign(MemoData);  {save data to field}
    End
    Else ShowMessage('No Memo Data!');
  End;
  ...
  Procedure CleanUp;
  Begin
    If (MemoData <> nil) Then MemoData.Free; {remember to clean up!}
  End;
  ...

That was from memory, so I'm not sure if it works, but if not, e-mail
me. Note that there is possibly a minor problem, if the lines in the
memo are longer than 255 chars, but the problem is the same with the
TMemo component as well, so it probably doesn't matter.

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 *

Other Threads