trichview.com

trichview.support




Re: Saving imported text to DB Field


Return to index


Author

Message

Bob Dalton

Posted: 02/15/2002 6:01:05


> I think: you need call Change method of TDBRichViewEdit.


Thanks indeed this solved the problem! Your english is more then good enough

to have solved the problem for me.


Not sure why this works though and I didn't see it in use in any of the

provided database examples. Also I am not directly using any call to any

stream methods that I know of. Perhaps AddNL is using them?


For the use of others here is the modified code to make it work in a

database field:


procedure TScriptsInfoForm1.SpeedButton3Click(Sender: TObject);

var

  F: TextFile;

  S: string;

begin

  OpenDialog1.InitialDir :=

IncludeTrailingBackSlash(ExtractFilePath(paramstr(0))) + 'scripts';

  if OpenDialog1.Execute then { Display Open dialog box }

  begin

    try

      rve.BeginUpdate; //rve is name for TDBRichViewEdit

      AssignFile(F, OpenDialog1.FileName);

      Reset(F);

      while not EOF(F) do

      begin

        Readln(F, S);

        //rve.AddNL(S, 0, 0); <-----Use this one for text witout cr/lf

        rve.AddTextNL(S, 0, 0, 0); //<---Use this one for text with cr/lf

      end;

      CloseFile(F);

    finally

      rve.EndUpdate;

      rve.Format;

      rve.Change;

    end;

  end;

end;


Regards;


Bob Dalton





Powered by ABC Amber Outlook Express Converter