Board index » delphi » TMemoField.Value := 'string' doesn't work

TMemoField.Value := 'string' doesn't work

Hi all,

I have a Paradox 5.0 table with a field of the type Memo in it. Delphi
1.0 automatically assigns a TMemoField to it. But the command

TableNameFieldName.Value := 'something';

doesn't work.
How else can I copy a string to it at runtime?

Thanks for your help.

Regards,
Arjan

---
Arjan Moraal
Paninaro Development
Groningen, The Netherlands

 

Re:TMemoField.Value := 'string' doesn't work


Take a look at this code, it show how a memo is read from a Memo control
and written to  two separate tables

NotesMemo is the edit control for a memo, clientTMemofield, is a
TMemofield which is actually external, but I inserted it here for
illustrative purposes.
The FieldByName lines are not really pertinent
CentralNotestableNotes is another TMemofield in the CentralNotes TTable

procedure TNoter.BitBtn1Click(Sender: TObject);
var
  memoText, memo2: TStringList;
  clientTMemoField: TMemoField;
begin
  with CentralNotestableNotes do
  begin
    Insert;
    FieldByName(kCenNotesNoteDate).AsDateTime :=
StrToDate(NoteDateEdit.Text);
    FieldByName(kCenNotesNoteTime).AsDateTime :=
StrToTime(NoteTimeEdit.Text);
    FieldByName(kCenNotesProjectName).AsString := ProjectNameEdit.Text;
    FieldByName(kCenNotesAlias).AsString := AliasEdit.Text;
    FieldByName(kCenNotesDocumentType).AsString :=
DocumentTypeDBLookupCombo.Text;
    FieldByName(kCenNotesFileName).AsString := FileNameEdit.Text;
    FieldByName(kCenNotesActivityType).AsString :=
ActivityTypeDBLookupCombo.Text;
    FieldByName(kCenNotesDocumentName).AsString := DocumentNameEdit.Text;
    CentralNotestableNotes.Assign(NotesMemo.Lines);
    Post;
    try
      memoText := TStringList.create;
      memo2 := TStringList.Create;
      memoText.Assign(NotesMemo.Lines);
      memoText.Insert(0, NoteDateEdit.Text + ' ' + NoteTimeEdit.Text);
      memo2.Assign(clientTMemoField);
      memoText.AddStrings(memo2);
      clientTMemoField.Dataset.Edit;
      clientTMemoField.Assign(memoText);
      clientTMemoField.Dataset.Post;
    finally
      memoText.Free;
      memo2.Free;
    end;
  end;
end;

Other Threads