Conversation

Inserting text into a DBMemo from another component

(overview of excerpts from articles in conversation)

Newsgroup: borland.public.delphi.database.interbaseexpress

# Lines
wrote on 06-Feb-2002:

Hi,
I have a DBMemo connected to a datasource which is supplied by an IBSQL
component (with attached IBUpdate). I also have a TComboBox that is
populated with some "stock" phrases. The idea is to allow the user to type
things directly into the DBMemo and occasionally select a stock phrase from
21
  
Craig Stuntz replied on 06-Feb-2002:

In article <3c612169_2@dnews>, ✉auditmaster.co.uk says...
  (snip)

DBMemo1.Datasource.Dataset.FieldByName(DBMemo1.DataField).AsString :=
  ComboBox1.Text;
  ...then get rid of the code above. In general, never update the
  value of a data-aware control. Always update the corresponding TField.
27
    
Stuart Cox replied on 06-Feb-2002:

Graig,
    Thanks for that BUT..
    I need to be able to go to the text, make some alterations, place the cursor
    at a specific point and then insert another phrase, do more editing etc etc.
    This is why I used SelText and the OnChange event of the "phrase selecter".
53
      
Craig Stuntz replied on 06-Feb-2002:

In article <3c6184ff$1_2@dnews>, ✉auditmaster.co.uk says...
      (snip)

You need to manipulate the text as desired and then assign the
      entire thing to the TField.
      sFoo := MyField.AsString;
      DoSomething(sFoo);
28
        
Stuart Cox replied on 07-Feb-2002:

Thanks again,
        FWIW I now do the following in the OnClick event of the combobox...
        DataSource.Edit;
        DBMemo.SelText := PhraseBox.Text;
        DataSource.FieldByName('FIELDNAME').asstring := DBMemo.Text;
49
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sat, 18 May 2024 09:27:34 UTC
Copyright © 2009-2024
HREF Tools Corp.